public static void ShowGettingStarted(int startTab = 0) { if (gettingStarted is null) { //New instance gettingStarted = new GettingStarted(startTab); gettingStarted.Show(); gettingStarted.FormClosing += delegate { settingsForm = null; GettingStarted.WebBrowserHandler.stopCheck = true; }; } else { //Focus gettingStarted.Focus(); } }
public static void ShowGettingStarted(int startTab = 0) { if (gettingStarted is null) { //New instance gettingStarted = new GettingStarted(startTab); gettingStarted.Show(); gettingStarted.FormClosing += delegate { settingsForm = null; }; } else { //Focus gettingStarted.Focus(); } }
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