/// <summary> /// called when downloads are enabled /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void downloadCloud_Checked_1(object sender, RoutedEventArgs e) { if (XmlDataLayer.GetConfigEntry("sync_online") == "enabled") { abortDownloadDriveThread(); XmlDataLayer.SetConfigEntry("download_cloud", "enabled"); Thread newThread = new Thread(() => GoogleDriveSync.UploadDownloadNewFiles()); newThread.Start(); } }
/// <summary> /// called when online sync is enabled /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuItem_Checked_1(object sender, RoutedEventArgs e) { MenuItem menuItem = sender as MenuItem; XmlDataLayer.SetConfigEntry("sync_online", "enabled"); string pcId = XmlDataLayer.GetConfigEntry("pc_id"); if (pcId == null) { Random rnd = new Random(); int id = rnd.Next(0, 1000000); XmlDataLayer.SetConfigEntry("pc_id", id.ToString()); } uploadCloud.IsEnabled = true; downloadCloud.IsEnabled = true; if (XmlDataLayer.GetConfigEntry("upload_cloud") == "enabled") { uploadCloud.IsChecked = true; } else { uploadCloud.IsChecked = false; } if (XmlDataLayer.GetConfigEntry("download_cloud") == "enabled") { downloadCloud.IsChecked = true; } else { downloadCloud.IsChecked = false; } Thread newThread = new Thread(() => GoogleDriveSync.UploadDownloadNewFiles()); newThread.Start(); MenuItem item = sender as MenuItem; bool x = item.IsChecked; }