|
I'd be using Timers for this purpose. As it's by far easier to control the execution of the timer instead of a thread.
I generally use the System.Threading.Timer with the following callback pattern:
Initialize it like that:
System.Threading.Timer _timer;
_timer = new System.Threading.Timer(OnTimer, null, 10000, System.Threading.Timeout.Infinite);
And this callback method
private void OnTimer(object state) {
try {
} catch (Exception ex) {
} finally {
_timer.Change(10000, System.Threading.Timeout.Infinite);
}
}
To stop the timer just call:
_timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
If you use it like that it should never ever be called concurrently as after the first event the timer is disabled until you manually reenable it (i.e. in the finally clause)
Greetings
|
|
|
|
|
Thanks Nicholas, I've never seen it done that way!
|
|
|
|
|
|
Please post your question in the forum at the end of that article, so the author can help you.
Use the best guess
|
|
|
|
|
What code do you currently have in place for creating the menus? How do your menu items relate to the database? Given that you've said that it should only be displayed when a user is logged in, you could easily just hide the menu items that the user shouldn't see by using the Visible property on the menu item.
|
|
|
|
|
Thank you! It's Worked!
|
|
|
|
|
hi ,
How to use this for sql server 2008
SQLiteDatabase db = this.getReadableDatabase();
ICursor mcursor = db.rawQuery(selectQuery, null);
i wanna get ICursor from Sql Server 2008 in C# (somthing like Sqlite)
cause i wanna use that in monodroid.
|
|
|
|
|
ICursor isn't an interface that's supported in SQL Server. What you have here is SqlLite specific code. In order to do something similar with SQL Server, you would want to create a SqlCommand object, associate it with a SqlConnection (you use this to Open the connection to the database) and then use ExecuteReader to get the equivalent behaviour. However, I doubt that you will be able to do this for MonoDroid as you would be required to install SQL Server drivers on the Droid device. Sorry.
|
|
|
|
|
thanks for reply.
I can use sql code without any problem.
just i wanna get ICursor.
is it possible to get ICursor even with Linq ?
|
|
|
|
|
As my reply indicated - ICursor is for SqlLite. It isn't for SQL Server. If you want to use the SQL Server functionality, you have to use the types that are supported.
|
|
|
|
|
what about DataTable Or .... ? ( give me advice )
can get ICursor from that? I should some how get ICursor any way ?
thanks in advanced!
|
|
|
|
|
Which bit of you can't do you not understand? Do you really not get that this is a SQLLite object?
|
|
|
|
|
|
What is your fixation with ICursor, what are you actually trying to do. I can't help thinking you are asking the wrong question, what do you want to use ICursor for?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hello everybody i need some help to get the same in the following link (c# code and class and dynamically and based on stored procedure database)
check the link
the link
thanks for all
|
|
|
|
|
Help with what?? You haven't asked a question yet.
|
|
|
|
|
Could you be more specific as to what have you done, what are you stuck with, errors you got (if any) or anything of the like?
As it is right now, it sounds more like you want someone to do it for you, in which case we cannot help you, but you can check in sites like Elance, Vworker, oDesk, etcetera, just remember: you get what you pay for.
If you think you can do a thing or think you can't do a thing, you're right - Henry Ford
Emmanuel Medina Lopez
|
|
|
|
|
thanks my dear i create the following table
CREATE TABLE [dbo].[ProductsCategories](
[ProductCategoryId] [int] IDENTITY(1,1) NOT NULL,
[CategoryValue] [nvarchar](50) NOT NULL,
[DateSent] [smalldatetime] NOT NULL,
[ZOrder] [int] NOT NULL,
[Hide] [bit] NOT NULL,
[ArCategoryValue] [nvarchar](50) NULL,
[ParentId] [int] NULL,
PRIMARY KEY CLUSTERED
(
[ProductCategoryId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProductsCategories] WITH CHECK ADD CONSTRAINT [FK_ProductsCategories_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[ProductsCategories] ([ProductCategoryId])
GO
ALTER TABLE [dbo].[ProductsCategories] CHECK CONSTRAINT [FK_ProductsCategories_ParentId]
GO
ALTER TABLE [dbo].[ProductsCategories] ADD CONSTRAINT [DF_ProductsCategories_DateSent] DEFAULT (getdate()) FOR [DateSent]
GO
ALTER TABLE [dbo].[ProductsCategories] ADD CONSTRAINT [DF_ProductsCategories_ZOrder] DEFAULT ((0)) FOR [ZOrder]
GO
ALTER TABLE [dbo].[ProductsCategories] ADD CONSTRAINT [DF_ProductsCategories_Hide] DEFAULT ((0)) FOR [Hide]
GO
ALTER TABLE [dbo].[ProductsCategories] ADD CONSTRAINT [DF_ProductsCategories_ParentId] DEFAULT ((0)) FOR [ParentId]
GO
i need to create cascading dropdownlist from productscategories table based on parentId
|
|
|
|
|
Ok 3 things:
1. It might be a cultural thing, but don't reply to somebody calling them "dear" on the internet, it's kinda creepy (and might scare away people)
2. What are you using to create your page? ASP.NET?
3. I can't help you right now giving detailed information, but if you do a simple google search for cascading dropdownlists[^] you'll find that there's plenty of information out there (heck, the 4th link is another question here on CodeProject for basically the same stuff you want to achieve)
And another thing: I know your native language probably isn't English, still, read the sticky post in this forum (the second one from the top) on tips about how to write your question so it will be received with a better attitude and you will get more people to respond.
Always try stuff on your own first, and search for solutions on your own (i.e. Google search), if you show you've done some effort, it is more likely that you will get help.
If after googling you can't seem to make it work, come back and show us what you have done and what's the problem that you have.
If you think you can do a thing or think you can't do a thing, you're right - Henry Ford
Emmanuel Medina Lopez
|
|
|
|
|
Hi, I am currently sitting on a slight problem.
I want to create a Windows Metro Style Application using C# in visual studios.
There is one problem though, I have no idea how to create the GUI completely.
I currently have a blank app and I would like to add a new item, item being a grid page. I cannot seem to be able to do this, and I have tried everything. Once I can get that done, I would like to be able to move through pages, and this must be compatible with landscape and portrait views, also with docking and snapping.
Please Help!
Kind regards,
A Developer
|
|
|
|
|
Member 10033886 wrote: I have tried everything. Including these[^]?
Use the best guess
|
|
|
|
|
Thanks a bunch, it didn't give me the answers completely but it set me on the right track.
|
|
|
|
|
Besides what Richard above linked, I would also recommend this book[^]
If you think you can do a thing or think you can't do a thing, you're right - Henry Ford
Emmanuel Medina Lopez
|
|
|
|
|
Start by reading some books.
|
|
|
|
|
i prefer using Microsoft Expression Blend for design, styles and applying graphic effects and then continue work on project in Visual Studio for coding.
also if you don't know about WPF, you must reading some educational resources[^] or you can use some available components about metro style like "Telerik Rad Control" which with them you don't need any more WPF.
-Amir Mohammad Nasrollahi
/* LIFE RUNS ON CODE */
|
|
|
|