Ejemplo n.º 1
0
        public AdvancedSettings()
        {
            InitializeComponent();

            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.KeyDown += delegate { MainProgram.SetCheckFolder(actionFolderPath.Text); };
            actionFolderPath.KeyUp   += delegate { MainProgram.SetCheckFolder(actionFolderPath.Text); };

            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
        }
        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);
            }
        }
Ejemplo n.º 3
0
        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 GettingStarted()
        {
            InitializeComponent();

            tabControl.Appearance = TabAppearance.FlatButtons;
            tabControl.ItemSize   = new Size(0, 1);
            tabControl.SizeMode   = TabSizeMode.Fixed;
            tabControl.BackColor  = Color.Transparent;

            tabControl.Selected += delegate {
                if (tabControl.SelectedIndex == 1)
                {
                    //Clicked on recommended setup guide (HTML), can show "move on" popover now
                    theWebBrowser.Document.InvokeScript("showHelpPopover");
                }
                else if (tabControl.SelectedIndex == 2)
                {
                    expert.Focus();
                }
            };

            //Auto-select "recommended" panel
            RecommendedClicked(null, null);
            finalOptionButton.FlatStyle = FlatStyle.Flat;
            finalOptionButton.FlatAppearance.BorderSize = 0;

            setupSelect.MouseHover += delegate {
                if (selectedPanel != recommendedPanel)
                {
                    recommendedPanel.borderColor = Pens.Black;
                    recommendedPanel.Refresh();
                }
                if (selectedPanel != expertPanel)
                {
                    expertPanel.borderColor = Pens.Black;
                    expertPanel.Refresh();
                }
            };

            //Recommended panel
            recommendedPanel.MouseHover += RecommendedHovered;
            recommendedPanel.Click      += RecommendedClicked;

            recommendedLabel.MouseHover += RecommendedHovered;
            recommendedLabel.Click      += RecommendedClicked;

            recommendedLabel2.MouseHover += RecommendedHovered;
            recommendedLabel2.Click      += RecommendedClicked;

            recommendedLabel3.MouseHover += RecommendedHovered;
            recommendedLabel3.Click      += RecommendedClicked;

            recommendedImage.MouseHover += RecommendedHovered;
            recommendedImage.Click      += RecommendedClicked;

            //Expert panel
            expertPanel.MouseHover += ExpertHovered;
            expertPanel.Click      += ExpertClicked;

            expertLabel1.MouseHover += ExpertHovered;
            expertLabel1.Click      += ExpertClicked;

            expertLabel2.MouseHover += ExpertHovered;
            expertLabel2.Click      += ExpertClicked;

            expertLabel2.MouseHover += ExpertHovered;
            expertLabel2.Click      += ExpertClicked;

            expertLabel3.MouseHover += ExpertHovered;
            expertLabel3.Click      += delegate {
                Process.Start("https://github.com/AlbertMN/AssistantComputerControl/wiki/Application-advanced-settings-expert-setup");
            };
            tooltip.SetToolTip(expertLabel3, "This will open a link in your default browser");

            expertLabel4.MouseHover += ExpertHovered;
            expertLabel4.Click      += ExpertClicked;

            expertImage.MouseHover += ExpertHovered;
            expertImage.Click      += ExpertClicked;

            //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.KeyUp   += delegate { MainProgram.SetCheckFolder(actionFolderPath.Text); };

            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;

            closeWindowButton.FlatStyle = FlatStyle.Flat;
            closeWindowButton.FlatAppearance.BorderSize = 0;

            //Browser
            theWebBrowser = GuideWebBrowser;

            string tes = "http://acc.albe.pw/recommended_setup.html?" + new Random().Next(10000);

            Console.WriteLine(tes);
            //theWebBrowser.Url = new Uri(tes);

            theWebBrowser.DocumentCompleted += BrowserDocumentCompleted;
            theWebBrowser.Navigating        += BrowserNavigating;
            theWebBrowser.NewWindow         += NewBrowserWindow;

            VisibleChanged += delegate {
                MainProgram.testingAction  = Visible;
                MainProgram.gettingStarted = Visible ? this : null;
            };
            FormClosed += delegate {
                MainProgram.testingAction  = false;
                MainProgram.gettingStarted = null;
            };
        }
        public GettingStarted(int startTab = 0)
        {
            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.Transparent;
            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();
                }
            };

            //Set GettingStarted web-browser things
            string 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;

            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;

            closeWindowButton.FlatStyle = FlatStyle.Flat;
            closeWindowButton.FlatAppearance.BorderSize = 0;

            VisibleChanged += delegate {
                MainProgram.testingAction  = Visible;
                MainProgram.gettingStarted = Visible ? this : null;
            };
            FormClosed += delegate {
                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();
                    }
                }));
            };
        }
Ejemplo n.º 6
0
        public GettingStarted(int startTab = 0)
        {
            InitializeComponent();
            Thread.CurrentThread.Priority = ThreadPriority.Highest;

            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.Transparent;
            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");
                }
                else if (tabControl.SelectedIndex == 2)
                {
                    expert.Focus();
                }
            };

            //Auto-select "recommended" panel
            RecommendedClicked(null, null);
            finalOptionButton.FlatStyle = FlatStyle.Flat;
            finalOptionButton.FlatAppearance.BorderSize = 0;

            setupSelect.MouseHover += delegate {
                if (selectedPanel != recommendedPanel)
                {
                    recommendedPanel.borderColor = Pens.Black;
                    recommendedPanel.Refresh();
                }
                if (selectedPanel != expertPanel)
                {
                    expertPanel.borderColor = Pens.Black;
                    expertPanel.Refresh();
                }
            };

            //Recommended panel
            recommendedPanel.MouseHover += RecommendedHovered;
            recommendedPanel.Click      += RecommendedClicked;

            recommendedLabel.MouseHover += RecommendedHovered;
            recommendedLabel.Click      += RecommendedClicked;

            recommendedLabel2.MouseHover += RecommendedHovered;
            recommendedLabel2.Click      += RecommendedClicked;

            recommendedLabel3.MouseHover += RecommendedHovered;
            recommendedLabel3.Click      += RecommendedClicked;

            recommendedImage.MouseHover += RecommendedHovered;
            recommendedImage.Click      += RecommendedClicked;

            //Expert panel
            expertPanel.MouseHover += ExpertHovered;
            expertPanel.Click      += ExpertClicked;

            expertLabel1.MouseHover += ExpertHovered;
            expertLabel1.Click      += ExpertClicked;

            expertLabel2.MouseHover += ExpertHovered;
            expertLabel2.Click      += ExpertClicked;

            expertLabel2.MouseHover += ExpertHovered;
            expertLabel2.Click      += ExpertClicked;

            expertLabel3.MouseHover += ExpertHovered;
            expertLabel3.Click      += delegate {
                Process.Start("https://acc.readme.io/v1.0/docs/application-advanced-settings-expert-setup");
            };
            tooltip.SetToolTip(expertLabel3, "This will open a link in your default browser");

            expertLabel4.MouseHover += ExpertHovered;
            expertLabel4.Click      += ExpertClicked;

            expertImage.MouseHover += ExpertHovered;
            expertImage.Click      += ExpertClicked;

            //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;

            closeWindowButton.FlatStyle = FlatStyle.Flat;
            closeWindowButton.FlatAppearance.BorderSize = 0;

            analyticsMoveOn.FlatStyle = FlatStyle.Flat;
            analyticsMoveOn.FlatAppearance.BorderSize = 0;

            //Browser
            theWebBrowser = GuideWebBrowser;

            theWebBrowser.DocumentCompleted += BrowserDocumentCompleted;
            theWebBrowser.Navigating        += BrowserNavigating;
            theWebBrowser.NewWindow         += NewBrowserWindow;

            VisibleChanged += delegate {
                MainProgram.testingAction  = Visible;
                MainProgram.gettingStarted = Visible ? this : null;
            };
            FormClosed += delegate {
                MainProgram.testingAction  = false;
                MainProgram.gettingStarted = null;
            };
        }