public static string CheckPath() { string path = currentLocation; if (Properties.Settings.Default.ActionFilePath != "") { //Custom path set if (Directory.Exists(Properties.Settings.Default.ActionFilePath)) { path = Properties.Settings.Default.ActionFilePath; } } else { if ((Properties.Settings.Default.HasCompletedTutorial && gettingStarted is null && !hasAskedForSetupAgain)) { //Dropbox not found & no custom filepath, go through setup again? hasAskedForSetupAgain = true; var msgBox = MessageBox.Show(Translator.__("no_cloudservice_chosen", "general"), "[ERROR] No folder specified | AssistantComputerControl", MessageBoxButtons.YesNo); if (msgBox == DialogResult.Yes) { ShowGettingStarted(); } } } return(Path.HasExtension(path) ? Path.GetDirectoryName(path) : path); }
public TestActionWindow() { InitializeComponent(); MaximizeBox = false; sWebBrowser = webBrowser; string fileName = Path.Combine(MainProgram.currentLocation, "WebFiles/ActionTester.html"); if (File.Exists(fileName)) { string fileLoc = "file:///" + fileName; Uri theUri = new Uri(fileLoc); sWebBrowser.Url = theUri; } else { sWebBrowser.Visible = false; } sWebBrowser.DocumentCompleted += delegate { browserLoaded = true; webBrowser.Document.InvokeScript("showLoader"); }; VisibleChanged += VisibilityChanged; FormClosed += delegate { MainProgram.testingAction = false; }; Text = Translator.__("window_name", "test_action_window"); string listeningInText = Translator.__("description", "test_action_window") + "\n\n" + Translator.__("listening_in", "test_action_window") + "\n" + MainProgram.CheckPath() + "\n" + Translator.__("listening_for", "test_action_window") + " \"." + Properties.Settings.Default.ActionFileExtension + "\""; actionTesterLabel.Text = listeningInText; }
private static void FileDownloadedCallback(object sender, AsyncCompletedEventArgs e) { if (MainProgram.updateProgressWindow != null) { MainProgram.updateProgressWindow.Close(); MainProgram.updateProgressWindow = null; } MainProgram.DoDebug("Finished downloading"); if (!e.Cancelled) { //Download success Process.Start(targetLocation); MainProgram.DoDebug("New installer successfully downloaded and opened."); Application.Exit(); } else { MainProgram.DoDebug("Failed to download new version of ACC. Error; " + e.Error); MessageBox.Show("Failed to download new version. Try again later!", Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } Thread.Sleep(500); Thread.CurrentThread.Abort(); }
public UpdateProgress() { InitializeComponent(); FormClosed += delegate { MainProgram.updateProgressWindow = null; }; Shown += delegate { Thread.CurrentThread.Priority = ThreadPriority.Highest; }; downloadingTitle.Text = Translator.__("title", "update_downloading"); description.Text = Translator.__("description", "update_downloading"); }
public AdvancedSettings() { InitializeComponent(); actionFolderPath.KeyDown += new KeyEventHandler(FreakingStopDingSoundNoHandle); actionFileExtension.KeyDown += new KeyEventHandler(FreakingStopDingSound); void FreakingStopDingSound(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; e.SuppressKeyPress = true; } } void FreakingStopDingSoundNoHandle(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; e.Handled = true; MainProgram.SetCheckFolder(actionFolderPath.Text); } } //actionFolderPath.KeyDown += delegate { pathChanged(); }; //actionFolderPath.KeyUp += delegate { pathChanged(); }; /*void pathChanged() { * MainProgram.SetCheckFolder(actionFolderPath.Text); * actionFolderPath.Text = MainProgram.CheckPath(); * }*/ actionFileExtension.KeyDown += delegate { MainProgram.SetCheckExtension(actionFileExtension.Text); }; actionFileExtension.KeyUp += delegate { MainProgram.SetCheckExtension(actionFileExtension.Text); }; actionFolderPath.Text = MainProgram.CheckPath(); actionFileExtension.Text = Properties.Settings.Default.ActionFileExtension; mainPanel.Click += delegate { mainPanel.Focus(); }; actionFolderPath.GotFocus += delegate { if (!hasUnfocused) { mainPanel.Focus(); hasUnfocused = true; } }; //Fixes it being auto-foxused Text = Translator.__("window_name", "advanced_settings"); foreach (Control x in this.Controls) { Translator.TranslateWinForms("advanced_settings", x.Controls); } }
private static void TrayCreateStartupLink(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show(Translator.__("start_with_pc_desc", "general"), MainProgram.messageBoxTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { MainProgram.SetStartup(true); MessageBox.Show(Translator.__("start_with_pc_yes", "general"), MainProgram.messageBoxTitle + ""); } else if (dialogResult == DialogResult.No) { MessageBox.Show(Translator.__("start_with_pc_no", "general"), MainProgram.messageBoxTitle); } }
private void checkForUpdate_Click(object sender, EventArgs e) { //Doesn't return true for some reason... To fix if (MainProgram.HasInternet()) { if (!new SoftwareUpdater().Check(true)) { MessageBox.Show(Translator.__("no_new_update", "check_for_update"), MainProgram.messageBoxTitle); } } else { MessageBox.Show(Translator.__("update_check_failed", "check_for_update"), Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } }
public static void SetCheckFolder(string setTo) { if (!String.IsNullOrEmpty(setTo)) { Console.WriteLine(setTo); if (!Directory.Exists(setTo) && setTo != null) { string[] splitted1 = setTo.Split('\\'); string[] splitted2 = setTo.Split('\\'); string[] splitted3 = setTo.Split('/'); string[] splitted4 = setTo.Split('/'); if (splitted1[splitted1.Length - 1] == "AssistantComputerControl" || splitted2[splitted2.Length - 1] == "AssistantComputerControl" || splitted3[splitted3.Length - 1] == "AssistantComputerControl" || splitted4[splitted4.Length - 1] == "AssistantComputerControl") { try { Directory.CreateDirectory(setTo); } catch { MessageBox.Show(Translator.__("invalid_path", "general"), MainProgram.messageBoxTitle); return; } } else { MessageBox.Show(Translator.__("invalid_path", "general"), MainProgram.messageBoxTitle); return; } } Console.WriteLine(setTo); SetRegKey("ActionFolder", setTo); Properties.Settings.Default.ActionFilePath = setTo; Properties.Settings.Default.Save(); SetRegKey("ActionFolder", setTo); SetupListener(); DoDebug("Check folder updated (" + CheckPath() + ")"); } else { MessageBox.Show(Translator.__("invalid_path", "general"), MainProgram.messageBoxTitle); } }
public void InitializeComponent() { TrayIcon = new NotifyIcon(); //System tray creation TrayIcon = new NotifyIcon() { Text = MainProgram.appName + " v" + MainProgram.softwareVersion, Icon = Properties.Resources.ACC_loading_light_icon }; //Add tray menu items trayMenu.MenuItems.Add(Translator.__("settings_title", "tray_menu"), delegate { MainProgram.ShowSettings(); }); trayMenu.MenuItems.Add(Translator.__("help_title", "tray_menu"), new EventHandler(TrayOpenHelp)); trayMenu.MenuItems.Add(Translator.__("exit_title", "tray_menu"), new EventHandler(TrayExit)); TrayIcon.ContextMenu = trayMenu; }
public void SetProgress(DownloadProgressChangedEventArgs e) { this.BeginInvoke((MethodInvoker) delegate { double bytesIn = double.Parse(e.BytesReceived.ToString()); double totalBytes = double.Parse(e.TotalBytesToReceive.ToString()); double percentage = bytesIn / totalBytes * 100; progressText.Text = int.Parse(Math.Truncate(percentage).ToString()) + "%"; var transString = Translator.__("downloaded_bytes", "update_downloading"); transString = transString.Replace("{x}", e.BytesReceived.ToString()); transString = transString.Replace("{y}", e.TotalBytesToReceive.ToString()); //byteText.Text = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive + " bytes"; byteText.Text = transString; progressBar.Value = int.Parse(Math.Truncate(percentage).ToString()); }); }
public static void TranslateWinForms(string domain, ControlCollection ctrl) { foreach (Control xx in ctrl) { if (xx is Label || xx is Button || xx is CheckBox || xx is LinkLabel) { if (xx.Text[0] != '|') { xx.Text = Translator.__(xx.Text, domain); } else { xx.Text = xx.Text.Remove(0, 1); } //TODO ADD TOOLTIP TEXT IF "_hover_content" EXISTS } } }
public static void DownloadFile(string url) { url += "&upgrade_id=" + Guid.NewGuid(); if (RemoteFileExists(url + "&just_checking")) { MainProgram.DoDebug("Downloading file from url; " + url); try { WebClient client = new WebClient(); Uri uri = new Uri(url); MainProgram.updateProgressWindow = new UpdateProgress(); MainProgram.updateProgressWindow.Show(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged); client.DownloadFileCompleted += new AsyncCompletedEventHandler(FileDownloadedCallback); targetLocation = Path.Combine(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "Downloads"), "ACCsetup.exe"); if (File.Exists(targetLocation)) { try { File.Delete(targetLocation); } catch (Exception ex) { MainProgram.DoDebug("Failed to delete file at " + targetLocation); MainProgram.DoDebug("Error; " + ex); } } client.DownloadFileAsync(uri, targetLocation); Application.Run(); } catch (Exception e) { MainProgram.DoDebug("Failed to download the new ACC installer; " + e.Message); MessageBox.Show(Translator.__("download_failed", "check_for_update"), Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } } else { MainProgram.DoDebug("Failed to update, installation URL does not exist (" + url + ")."); MessageBox.Show(Translator.__("website_offline", "check_for_update"), Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } }
private static void FileDownloadedCallback(object sender, AsyncCompletedEventArgs e) { if (MainProgram.updateProgressWindow != null) { MainProgram.updateProgressWindow.Close(); MainProgram.updateProgressWindow = null; } MainProgram.DoDebug("Finished downloading"); if (!e.Cancelled) { //Download success try { if (File.Exists(targetLocation)) { Process.Start(targetLocation); MainProgram.DoDebug("New installer successfully downloaded and opened."); Application.Exit(); } else { MainProgram.DoDebug("Downloaded file doesn't exist (new version)"); MessageBox.Show("Failed to download new version of ACC. File doesn't exist", Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } } catch (Exception ee) { MainProgram.DoDebug("Error occurred on open of new version; " + ee.Message); MessageBox.Show("Failed to open new version! Error is logged, please contact the developer on Discord!", Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } } else { MainProgram.DoDebug("Failed to download new version of ACC. Error; " + e.Error); MessageBox.Show("Failed to download new version. Try again later!", Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle); } Thread.Sleep(500); Thread.CurrentThread.Abort(); }
public TestActionWindow() { InitializeComponent(); MaximizeBox = false; sWebBrowser = webBrowser; //TODO: Make it local //webBrowser.Url = new Uri(String.Format("file:///{0}/test.html", MainProgram.currentLocation)); sWebBrowser.Url = new Uri("https://assistantcomputercontrol.com/success_error_listen.html"); sWebBrowser.DocumentCompleted += delegate { browserLoaded = true; webBrowser.Document.InvokeScript("showLoader"); }; VisibleChanged += VisibilityChanged; FormClosed += delegate { MainProgram.testingAction = false; }; Text = Translator.__("window_name", "test_action_window"); string listeningInText = Translator.__("description", "test_action_window") + "\n\n" + Translator.__("listening_in", "test_action_window") + "\n" + MainProgram.CheckPath() + "\n" + Translator.__("listening_for", "test_action_window") + " \"." + Properties.Settings.Default.ActionFileExtension + "\""; actionTesterLabel.Text = listeningInText; }
public SettingsForm() { InitializeComponent(); versionInfo.Text = "|Version " + MainProgram.softwareVersion; computerName.KeyDown += new KeyEventHandler(FreakingStopDingSound); fileEditedMargin.KeyDown += new KeyEventHandler(FreakingStopDingSound); fileReadDelay.KeyDown += new KeyEventHandler(FreakingStopDingSound); void FreakingStopDingSound(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; e.SuppressKeyPress = true; } } //Set values startWithWindows.Checked = Properties.Settings.Default.StartWithWindows; checkUpdates.Checked = Properties.Settings.Default.CheckForUpdates; betaProgram.Checked = Properties.Settings.Default.BetaProgram; warnDeletion.Checked = Properties.Settings.Default.WarnWhenDeletingManyFiles; defaultComputer.Checked = Properties.Settings.Default.DefaultComputer; computerName.Text = Properties.Settings.Default.ComputerName; fileEditedMargin.Value = (decimal)Properties.Settings.Default.FileEditedMargin; fileReadDelay.Value = (decimal)Properties.Settings.Default.FileReadDelay; maxDeleteFiles.Value = Properties.Settings.Default.MaxDeleteFiles; maxDeleteFiles.Enabled = warnDeletion.Checked; infoTooltip.SetToolTip(betaProgram, "Receive updates on new beta versions (often unstable, experimental builds)"); mainPanel.Click += delegate { mainPanel.Focus(); }; //On change //Has to be down & up, otherwise the last character isn't appended for some reason computerName.KeyDown += delegate { Properties.Settings.Default.ComputerName = computerName.Text; Properties.Settings.Default.Save(); }; computerName.KeyUp += delegate { Properties.Settings.Default.ComputerName = computerName.Text; Properties.Settings.Default.Save(); }; fileEditedMargin.ValueChanged += delegate { Properties.Settings.Default.FileEditedMargin = (float)fileEditedMargin.Value; Properties.Settings.Default.Save(); }; fileReadDelay.ValueChanged += delegate { Properties.Settings.Default.FileReadDelay = (float)fileReadDelay.Value; Properties.Settings.Default.Save(); }; maxDeleteFiles.ValueChanged += delegate { Properties.Settings.Default.MaxDeleteFiles = (int)maxDeleteFiles.Value; Properties.Settings.Default.Save(); }; /* Translations */ int i = 0; string activeLanguage = Properties.Settings.Default.ActiveLanguage; foreach (string item in Translator.languagesArray) { programLanguage.Items.Add(item); if (activeLanguage == item) { programLanguage.SelectedIndex = i; } ++i; } Text = Translator.__("window_name", "settings"); foreach (Control x in this.Controls) { Translator.TranslateWinForms("settings", x.Controls); } }
public bool Check(bool debug = false) { if (MainProgram.isCheckingForUpdate) { return(false); } MainProgram.isCheckingForUpdate = true; MainProgram.DoDebug("Checking for updates..."); string latestReleaseJson = null; string latestBetaJson = null; //Check and get latest if (Properties.Settings.Default.LastOpenedDate.Date != DateTime.UtcNow.Date) { releaseJsonUrl += "&daily_check"; betaJsonUrl += "&daily_check"; Properties.Settings.Default.LastOpenedDate = DateTime.UtcNow; Properties.Settings.Default.Save(); } if (RemoteFileExists(releaseJsonUrl)) { using (WebClient client = new WebClient()) { latestReleaseJson = client.DownloadString(releaseJsonUrl); } if (latestReleaseJson == string.Empty) { latestReleaseJson = null; } } //Check and get beta if (Properties.Settings.Default.BetaProgram && RemoteFileExists(betaJsonUrl)) { using (WebClient client = new WebClient()) { latestBetaJson = client.DownloadString(betaJsonUrl); } if (latestBetaJson == string.Empty) { latestBetaJson = null; } } if (latestReleaseJson != null || latestBetaJson != null) { Version newVersion = null , latestRelease , latestBeta; if (latestReleaseJson != null && latestBetaJson != null) { //Beta program enabled; check both release and beta for newest update latestRelease = JsonConvert.DeserializeObject <Version>(latestReleaseJson); latestBeta = JsonConvert.DeserializeObject <Version>(latestBetaJson); if (DateTime.Parse(latestRelease.datetime) > DateTime.Parse(MainProgram.releaseDate) || DateTime.Parse(latestBeta.datetime) > DateTime.Parse(MainProgram.releaseDate)) { //Both latest release and beta is ahead of this current build if (DateTime.Parse(latestRelease.datetime) > DateTime.Parse(latestBeta.datetime)) { //Release is newest newVersion = latestRelease; } else { //Beta is newest newVersion = latestBeta; } } else { //None of them are newer. Nothing new MainProgram.DoDebug("Software up to date (beta program enabled)"); MainProgram.isCheckingForUpdate = false; return(false); } } else if (latestReleaseJson != null && latestBetaJson == null) { //Only check latest latestRelease = JsonConvert.DeserializeObject <Version>(latestReleaseJson); if (DateTime.Parse(latestRelease.datetime) > DateTime.Parse(MainProgram.releaseDate) && latestRelease.version != MainProgram.softwareVersion) { //Newer build newVersion = latestRelease; } else { //Not new, move on MainProgram.DoDebug("Software up to date"); MainProgram.isCheckingForUpdate = false; return(false); } } else if (latestReleaseJson == null && latestBetaJson != null) { //Couldn't reach "latest" update, but beta-updates are enabled latestBeta = JsonConvert.DeserializeObject <Version>(latestBetaJson); if (latestBeta != null) { if (DateTime.Parse(latestBeta.datetime) > DateTime.Parse(MainProgram.releaseDate)) { //Newer build newVersion = latestBeta; } else { //Not new, move on MainProgram.DoDebug("Software up to date (beta program enabled)"); MainProgram.isCheckingForUpdate = false; return(false); } } } else { MainProgram.DoDebug("Both release and beta is NULL, no new updates, or no contact to the server."); } if (newVersion != null && newVersion.version != MainProgram.softwareVersion) { //New version available MainProgram.DoDebug("New software version found (" + newVersion.version + ") [" + newVersion.type + "], current; " + MainProgram.softwareVersion); DialogResult dialogResult = MessageBox.Show(Translator.__("new_version_found", "check_for_update").Replace("{version_num}", newVersion.version).Replace("{version_type}", newVersion.type), Translator.__("new_version_found_title", "check_for_update") + " | " + MainProgram.messageBoxTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { MainProgram.DoDebug("User chose \"yes\" to install update"); DownloadFile(newVersion.installpath + "&upgrade=true"); } else if (dialogResult == DialogResult.No) { MainProgram.DoDebug("User did not want to install update"); } MainProgram.isCheckingForUpdate = false; return(true); } else { MainProgram.DoDebug("Software up to date"); if (debug) { MessageBox.Show(Translator.__("no_new_update", "check_for_update"), Translator.__("check_for_update_title", "check_for_update") + " | " + MainProgram.messageBoxTitle); } } } else { MainProgram.DoDebug("Could not reach the webserver (both 'release' and 'beta' json files couldn't be reached)"); if (debug) { MessageBox.Show(Translator.__("webservers_offline", "check_for_update"), Translator.__("check_for_update_title", "check_for_update") + " | " + MainProgram.messageBoxTitle); } } MainProgram.isCheckingForUpdate = false; return(false); }
/* End credit */ public static void ErrorMessageBox(string msg, string title = "") { new Thread(() => { MessageBox.Show(msg, (!String.IsNullOrEmpty(title) ? title : Translator.__("error", "general") + " | " + MainProgram.messageBoxTitle)); }).Start(); }
public GettingStarted(int startTab = 0) { //Start function thisForm = this; InitializeComponent(); Thread.CurrentThread.Priority = ThreadPriority.Highest; theTabControl = tabControl; FormClosed += delegate { if (MainProgram.aboutVersionAwaiting) { Properties.Settings.Default.LastKnownVersion = MainProgram.softwareVersion; new NewVersion().Show(); Properties.Settings.Default.Save(); } }; tabControl.Appearance = TabAppearance.FlatButtons; tabControl.ItemSize = new Size(0, 1); tabControl.SizeMode = TabSizeMode.Fixed; tabControl.BackColor = Color.White; tabControl.SelectTab(startTab); tabControl.Selected += delegate { if (tabControl.SelectedIndex == 1) { //Clicked on recommended setup guide (HTML), can show "move on" popover now //theWebBrowser.Document.InvokeScript("showHelpPopover"); // Why would I do this...? } else if (tabControl.SelectedIndex == 2) { expert.Focus(); } }; backToSetupGuide.Visible = false; theInstance = this; //Set GettingStarted web-browser things (unless user has IE >9) //Check for IE version using JS, as the C# way requires admin rights, which we don't want to ask for just because of this... string fileName = Path.Combine(MainProgram.currentLocation, "WebFiles/IECheck.html"); /* Internet Explorer test */ if (File.Exists(fileName)) { string fileLoc = "file:///" + fileName; Uri theUri = new Uri(fileLoc); ieWebBrowser.Url = theUri; } else { ieWebBrowser.Visible = false; } ieWebBrowser.ObjectForScripting = new WebBrowserHandler(); theWebBrowser = ieWebBrowser; //theWebBrowser.DocumentCompleted += BrowserDocumentCompleted; theWebBrowser.Navigating += BrowserNavigating; theWebBrowser.NewWindow += NewBrowserWindow; /* Getting Started */ fileName = Path.Combine(MainProgram.currentLocation, "WebFiles/GettingStarted.html"); if (File.Exists(fileName)) { string fileLoc = "file:///" + fileName; Uri theUri = new Uri(fileLoc); GettingStartedWebBrowser.Url = theUri; } else { GettingStartedWebBrowser.Visible = false; } GettingStartedWebBrowser.ObjectForScripting = new WebBrowserHandler(); theWebBrowser = GettingStartedWebBrowser; theDoneActionViewBrowser = doneActionViewBrowser; theDoneActionViewBrowser.DocumentCompleted += DoneActionGridLoadCompleted; theDoneActionViewBrowser.Navigating += BrowserNavigating; theDoneActionViewBrowser.NewWindow += NewBrowserWindow; theWebBrowser.DocumentCompleted += BrowserDocumentCompleted; theWebBrowser.Navigating += BrowserNavigating; theWebBrowser.NewWindow += NewBrowserWindow; //Further expert settings actionFolderPath.KeyDown += new KeyEventHandler(FreakingStopDingSound); actionFileExtension.KeyDown += new KeyEventHandler(FreakingStopDingSound); void FreakingStopDingSound(Object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; e.SuppressKeyPress = true; } } actionFolderPath.Text = MainProgram.CheckPath(); actionFileExtension.Text = Properties.Settings.Default.ActionFileExtension; actionFolderPath.KeyDown += delegate { MainProgram.SetCheckFolder(actionFolderPath.Text); actionFolderPath.Text = MainProgram.CheckPath(); }; actionFolderPath.KeyUp += delegate { MainProgram.SetCheckFolder(actionFolderPath.Text); actionFolderPath.Text = MainProgram.CheckPath(); }; actionFileExtension.KeyDown += delegate { MainProgram.SetCheckExtension(actionFileExtension.Text); }; actionFileExtension.KeyUp += delegate { MainProgram.SetCheckExtension(actionFileExtension.Text); }; expert.Click += delegate { expert.Focus(); }; customSetupInfo.Click += delegate { expert.Focus(); }; expertDoneButton.FlatStyle = FlatStyle.Flat; expertDoneButton.FlatAppearance.BorderSize = 0; VisibleChanged += delegate { MainProgram.testingAction = Visible; MainProgram.gettingStarted = Visible ? this : null; isConfiguringActions = Visible; }; FormClosed += delegate { //Is needed isConfiguringActions = false; MainProgram.testingAction = false; MainProgram.gettingStarted = null; }; this.HandleCreated += delegate { Invoke(new Action(() => { FlashWindow.Flash(this); if (Application.OpenForms[this.Name] != null) { Application.OpenForms[this.Name].Activate(); Application.OpenForms[this.Name].Focus(); } })); }; //"Expert setup" translations customSetupTitle.Text = Translator.__("title", "expert_setup"); customSetupInfo.Text = Translator.__("description", "expert_setup"); actionFolderPathLabel.Text = Translator.__("action_folder_path", "expert_setup"); actionFileExtensionLabel.Text = Translator.__("action_file_extension", "expert_setup"); disclaimerLabel.Text = Translator.__("disclaimer", "expert_setup"); backToSetupGuide.Text = Translator.__("back_to_setup", "expert_setup"); expertDoneButton.Text = Translator.__("done_button", "expert_setup"); } // End main function
public void CloudServiceChosen(string service = "") { switch (service) { case "dropbox": case "onedrive": case "googledrive": backgroundCheckerServiceName = service; break; default: return; } if (CloudServiceFunctions.GetCloudServicePath(backgroundCheckerServiceName) != "") { //Cloud service found MainProgram.DoDebug("Cloud service " + backgroundCheckerServiceName + " is installed"); bool partial = false; if (backgroundCheckerServiceName == "googledrive") { partial = CloudServiceFunctions.GetGoogleDriveFolder() != String.Empty; } if (theWebBrowser != null) { IntPtr theHandle = IntPtr.Zero; try { theHandle = theWebBrowser.Handle; } catch { MainProgram.DoDebug("Failed to get web browser handle."); MessageBox.Show(Translator.__("cloud_setup_failed", "general"), MainProgram.messageBoxTitle); } if (theHandle != IntPtr.Zero) { if (theWebBrowser.Handle != null) { theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[2] { true, partial }); } } } if (partial) { CheckLocalGoogleDrive(); } } else { //Not found new Thread(() => { Thread.CurrentThread.IsBackground = true; string checkValue = ""; stopCheck = false; MainProgram.DoDebug("Could not find cloud service. Running loop to check"); while (checkValue == "" && !stopCheck) { checkValue = CloudServiceFunctions.GetCloudServicePath(backgroundCheckerServiceName); Thread.Sleep(1000); } if (stopCheck) { stopCheck = false; return; } //Cloud service has been installed since we last checked! MainProgram.DoDebug("Cloud service has been installed since last check. Proceed."); if (theWebBrowser != null) { if (theWebBrowser.Handle != null) { theWebBrowser.Invoke(new Action(() => { if (backgroundCheckerServiceName == "googledrive") { bool partial = CloudServiceFunctions.GetGoogleDriveFolder() != String.Empty; theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[2] { true, partial }); if (partial) { CheckLocalGoogleDrive(); } } else { theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[1] { true }); } })); } } }).Start(); } }
public UserFeedback() { InitializeComponent(); Text = Translator.__("window_name", "user_feedback_window"); }
public void AddOpenOnStartupMenu() { trayMenu.MenuItems.Add(Translator.__("open_on_startup", "tray_menu"), new EventHandler(TrayCreateStartupLink)); }