protected override void OnInvoke(ScheduledTask task) { Task = task; scheduledUpdates = 0; completedUpdates = 0; statusUpdateDb = new StatusUpdateDataContext(StatusUpdateDataContext.DBConnectionString); // Define the query to gather all of the to-do items. var statusItemsInDB = from statusUpdateItem statusItem in statusUpdateDb.StatusUpdateItems select statusItem; NetworkInformationUtility.GetNetworkTypeCompleted += GetNetworkTypeCompleted; NetworkInformationUtility.GetNetworkTypeAsync(3000); // Timeout of 3 seconds // Execute the query and place the results into a collection. StatusUpdateItems = new ObservableCollection <statusUpdateItem>(statusItemsInDB); //TODO: Add code to perform your task in background string toastMessage = "Started"; ShellToast toast = new ShellToast(); toast.Title = "Started"; toast.Content = toastMessage; toast.Show(); //var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(10) }; //timer.Tick += (sender2, args) => { stopPosting(); timer.Stop(); }; //timer.Start(); //var timer2 = new DispatcherTimer { Interval = TimeSpan.FromSeconds(24) }; //timer2.Tick += (sender3, args3) => { notify(); timer2.Stop(); }; //timer2.Start(); //postOnFb(); //postOnLinkedin(); //postOnTwitter(); //NotifyComplete(); }
// Constructor public MainPage() { InitializeComponent(); // Sample code to localize the ApplicationBar //BuildLocalizedApplicationBar(); statusUpdateDb = new StatusUpdateDataContext(StatusUpdateDataContext.DBConnectionString); // Data context and observable collection are children of the main page. this.DataContext = this; serviceUpload = new UploadService(); serviceUpload.dispatcher = Dispatcher; serviceUpload.RefreshTransfers(); var statusItemsInDB = from statusUpdateItem statusItem in statusUpdateDb.StatusUpdateItems select statusItem; // Execute the query and place the results into a collection. StatusUpdateItems = new ObservableCollection <statusUpdateItem>(statusItemsInDB); queuedCount.Text = StatusUpdateItems.Count.ToString(); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(2) }; timer.Tick += (sender, args) => { updateTile(); }; timer.Start(); StartPeriodicTask(); //SendPost(); /*serverFolder folderInfo = new serverFolder(); * if (folderInfo.status == 0) * { * folderInfo.serverFolderUpdateInfo(1); * ServerFolderHandler serverHandler = new ServerFolderHandler(); * serverHandler.dispatcher = Dispatcher; * serverHandler.StartUpload(); * } * else * { * if (folderInfo.status == 1) * { * ServerFolderHandler serverHandler = new ServerFolderHandler(); * serverHandler.dispatcher = Dispatcher; * serverHandler.RefreshTransfers(); * } * } */ }
public QueuedUpdates() { InitializeComponent(); this.Loaded += new RoutedEventHandler(MainPage_Loaded); statusUpdateDb = new StatusUpdateDataContext(StatusUpdateDataContext.DBConnectionString); // Data context and observable collection are children of the main page. this.DataContext = this; }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Language display initialization InitializeLanguage(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Application.Current.Host.Settings.EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Prevent the screen from turning off while under the debugger by disabling // the application's idle detection. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } using (StatusUpdateDataContext db = new StatusUpdateDataContext(StatusUpdateDataContext.DBConnectionString)) { if (db.DatabaseExists() == false) { //Create the database db.CreateDatabase(); } } tokens = new ACCESSTOKENS(); fbaccesstokenkey = tokens.fbtoken; twaccesstokenkey = tokens.twtoken; ldaccesstokenkey = tokens.ldtoken; twaccesstokensecret = tokens.twsecret; fbFriendsData = new FbFriends(); }
public Page3() { InitializeComponent(); statusUpdateDb = new StatusUpdateDataContext(StatusUpdateDataContext.DBConnectionString); // Data context and observable collection are children of the main page. this.DataContext = this; if (imageStatus) { byteImage = ImageToBytes(image); Chosen_Image.Source = image; } statuspreview(); }