Пример #1
0
        private void loadConfigWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!(bool)e.Result)
            {
                // First run behaviour

                /*
                 * actionButton.Enabled = true;
                 * statusLabel.Text = "Invalid username";
                 * MessageBox.Show("Select a valid username, and check that at least " +
                 *  "one shared folder is present. When you're ready, press 'Reconnect'", "Can't connect to server");
                 */

                //Defaults for config should be set here

                String defaultDownloadFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile)
                                               + "\\Bounce Downloads";

                serverTextBox.Text  = "192.168.1.40:3000";
                downloadFolder.Text = defaultDownloadFolder;
                sharedFolders.Items.Add(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos));
                sharedFolders.Items.Add(defaultDownloadFolder);

                Configuration.downloadFolder = defaultDownloadFolder;
                Configuration.server         = serverTextBox.Text;
                Configuration.sharedFolders  = new List <string>();
                Configuration.sharedFolders.Add(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos));
                Configuration.sharedFolders.Add(defaultDownloadFolder);

                WelcomeForm welcomeForm = new WelcomeForm();
                welcomeForm.ShowDialog();

                if (!welcomeForm.verified)
                {
                    MainTabControl.SelectedIndex = 3;
                }

                usernameTextBox.Text   = welcomeForm.username;
                Configuration.username = usernameTextBox.Text;
                Configuration.saveConfiguration();
            }
            else
            {
                statusLabel.Text = "Loaded configuration successfully";

                usernameTextBox.Text = Configuration.username;
                downloadFolder.Text  = Configuration.downloadFolder;
                serverTextBox.Text   = Configuration.server;
                foreach (string sharedFolder in Configuration.sharedFolders)
                {
                    sharedFolders.Items.Add(sharedFolder);
                }
            }

            textboxesInitialized = true;
            registerWorker.RunWorkerAsync();
            statusPictureBox.Image = Resources.connection_working;
            mainToolTip.SetToolTip(statusPictureBox, "Trying to connect..");
            statusLabel.Text = "Connecting..";
        }
Пример #2
0
        private void GotoScreen(ScreenType targetScreenType)
        {
            currentScreenType = targetScreenType;
            ReleaseCheckedMenu();
            if (targetScreenType != ScreenType.Welcome && !propMenuItem.Enabled)
            {
                propMenuItem.Enabled = true;
            }
            switch (targetScreenType)
            {
            case ScreenType.Welcome:
                _ = new WelcomeForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.RadioGroup:
                _ = new RadioGroupForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.CheckBoxGroup:
                _ = new CheckBoxGroupForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(targetScreenType), targetScreenType, null);
            }
        }
Пример #3
0
        private void GotoScreen(ScreenType targetScreenType)
        {
            currentScreenType = targetScreenType;
            ReleaseCheckedMenu();
            switch (targetScreenType)
            {
            case ScreenType.Welcome:
                _ = new WelcomeForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.ListBox:
                _ = new ListBoxForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                listMenuItem.Checked = true;
                break;

            case ScreenType.TwoListBoxes:
                _ = new TwoListBoxesForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                twoListMenuItem.Checked = true;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(targetScreenType), targetScreenType, null);
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            try
            {
                //初始化
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //创建欢迎窗体界面
                WelcomeForm startform = new WelcomeForm();

                //设置启动参数
                startform.StartupParams = args;

                //显示欢迎窗体
                startform.Show();

                //开始消息循环
                Program.context     = new ApplicationContext();
                Program.context.Tag = startform;
                Application.Run(Program.context);
            }
            catch (Exception exxx)
            {
                MessageBox.Show("启动失败!Ex:" + exxx.ToString(), "错误", MessageBoxButtons.OK);
            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            WelcomeForm w = new WelcomeForm();

            this.Hide();
            w.Show();
        }
Пример #6
0
        public WelcomeScreen()
        {
            SUI    = new UI();
            bg_img = new FusionEngine.Texture.Texture2D("data/ui/skin/windowbg1.png", FusionEngine.Texture.LoadMethod.Single, true);
            BG     = (ImageForm) new ImageForm().Set(0, 0, FusionEngine.App.AppInfo.W, FusionEngine.App.AppInfo.H);
            BG.SetImage(bg_img);
            MainForm = (WelcomeForm) new WelcomeForm().Set(450, 200, FusionEngine.App.AppInfo.W - 900, 250, "Welcome to Fusion");
            BGForm   = (BackgroundForm) new BackgroundForm(20).Set(0, 0, FusionEngine.App.AppInfo.W, FusionEngine.App.AppInfo.H);
            var bgi = new ImageForm().Set(0, 0, FusionEngine.App.AppInfo.W, FusionEngine.App.AppInfo.H, "");

            bgi.SetImage(new FusionEngine.Texture.Texture2D("data/ui/bg1.jpg", FusionEngine.Texture.LoadMethod.Single, false));
            bgi.Add(BGForm);
            SUI.Root.Add(bgi);

            BGForm.Add(MainForm);
            //  SUI.Top = MainForm;
            MainForm.Create = (user, pass) =>
            {
                Console.WriteLine("Creating new account. User:"******" Pass:" + pass);
            };

            Com     = new FusionEngine.Composition.Composite();
            BloomUI = new FusionEngine.Composition.Compositers.BloomUICompositer();
            dynamic ui = BloomUI.InputFrame;

            ui.GUI = SUI;
            Com.AddCompositer(BloomUI);
            int t = System.Environment.TickCount + 8000;

            while (System.Environment.TickCount < t)
            {
            }
        }
Пример #7
0
        private void GotoScreen(ScreenType targetScreenType)
        {
            currentScreenType = targetScreenType;
            switch (targetScreenType)
            {
            case ScreenType.Welcome:
                _ = new WelcomeForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.StatusBarCommon:
                _ = new StatusBarCommonForm {
                    panel1 = { Parent = panel1 }
                };
                StatusBar = statusBar1;
                break;

            case ScreenType.MainWindowCommon:
                _ = new MainMenuForm(this)
                {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.TextBox:
                MainMenu.Items.Clear();
                _ = new TextBoxForm {
                    panel1 = { Parent = panel1 }
                };
                break;
            }
        }
Пример #8
0
        public void Should_BePossibleTo_GetWebDriverInstance()
        {
            var url     = new WelcomeForm().Url;
            var browser = AqualityServices.Browser;

            browser.Driver.Navigate().GoToUrl(url);
            Assert.AreEqual(browser.Driver.Url, url);
        }
Пример #9
0
        public void Should_BePossibleTo_StartBrowserAndNavigate()
        {
            var url     = new WelcomeForm().Url;
            var browser = AqualityServices.Browser;

            browser.GoTo(url);
            Assert.AreEqual(browser.CurrentUrl, url);
        }
Пример #10
0
        public void ShowWelcomeForm()
        {
            this.Hide();
            WelcomeForm wf = new WelcomeForm();

            wf.ShowDialog();
            this.Close();
        }
Пример #11
0
        public void Should_BePossibleTo_GetElementText()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            Assert.AreEqual(WelcomeForm.SubTitle, welcomeForm.SubTitleLabel.JsActions.GetElementText(),
                            $"Sub title should be {WelcomeForm.SubTitle}");
        }
        public void Should_BePossibleTo_Click()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            welcomeForm.GetExampleLink(AvailableExample.Dropdown).MouseActions.Click();
            Assert.IsTrue(new DropdownForm().State.WaitForDisplayed(), "Dropdown form should be displayed");
        }
Пример #13
0
        public void Should_BePossibleTo_OpenNewBrowserAfterQuit()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            AqualityServices.Browser.Quit();

            Assert.AreNotEqual(welcomeForm.Url, AqualityServices.Browser.CurrentUrl);
        }
Пример #14
0
        public void Should_BePossibleTo_GetViewPortCoordinates()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            var actualPoint = welcomeForm.SubTitleLabel.JsActions.GetViewPortCoordinates();

            Assert.IsFalse(actualPoint.IsEmpty, "Coordinates of Sub title should not be empty");
        }
Пример #15
0
        private void GotoScreen(ScreenType targetScreenType)
        {
            propMenuItem.Visible = false;
            currentScreenType    = targetScreenType;
            ReleaseCheckedMenu();
            switch (targetScreenType)
            {
            case ScreenType.Welcome:
                _ = new WelcomeForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.Button:
                _ = new ButtonForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.CheckBox:
                _ = new CheckBoxForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.RadioButton:
                _ = new RadioButtonForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.MessageBox:
                _ = new MessageBoxForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.ProgressBar:
                _ = new ProgressBarForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                propMenuItem.Visible = true;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(targetScreenType), targetScreenType, null);
            }

            var element = controlsMenuItem.Items.Cast <MenuItem>().FirstOrDefault(x => (ScreenType)x.Tag == targetScreenType);

            if (element != null)
            {
                element.Checked = true;
            }
        }
Пример #16
0
        public void Should_BePossibleTo_GetXPathLocator()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            var          actualLocator   = welcomeForm.SubTitleLabel.JsActions.GetXPath();
            const string expectedLocator = "/html/body/DIV[2]/DIV[1]/H2[1]";

            Assert.AreEqual(expectedLocator, actualLocator, $"Locator of sub title should be {expectedLocator}");
        }
Пример #17
0
        public void Should_BePossibleTo_OpenUrlInNewTab()
        {
            var url     = new WelcomeForm().Url;
            var browser = AqualityServices.Browser;

            browser.Tabs().OpenInNewTab(url);
            browser.Tabs().SwitchToLastTab();
            Assert.AreEqual(2, browser.Tabs().TabHandles.Count);
            Assert.AreEqual(browser.Driver.Url, url);
        }
Пример #18
0
        public void Should_BePossibleTo_HighlightElement()
        {
            var welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            var dropdownExample = welcomeForm.GetExampleLink(AvailableExample.Dropdown);

            dropdownExample.JsActions.HighlightElement(HighlightState.Highlight);
            var border = dropdownExample.GetCssValue("border");

            Assert.AreEqual("3px solid rgb(255, 0, 0)", border, "Element should be highlighted");
        }
Пример #19
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            WelcomeForm wf = new WelcomeForm();

            this.AddOwnedForm(wf);
            if (wf.ShowDialog() == DialogResult.Cancel)
            {
                this.Close();
            }

            updater.DoUpdateAsync();
        }
Пример #20
0
 public void Start()
 {
     try
     {
         _welcomeForm = new WelcomeForm();
         _welcomeForm.Show();
         IsStarted = true;
         Others.ProductStatusLog(Products.ProductName, 4);
     }
     catch (Exception e)
     {
         Logging.WriteError("Flying To Ground Profiles Converter > Main > Start(): " + e);
     }
 }
Пример #21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //If we are to welcome the user..
            if (AppSettings.Settings.ShowWelcomeForm || forceWelcome)
            {
                //Then initialize our welcome form
                WelcomeForm welcomeForm = new WelcomeForm();
                welcomeForm.MdiParent = this;
                welcomeForm.Show();
            }

            //Show the form
            Show();
        }
Пример #22
0
 private static void Application_Idle(object sender, EventArgs e)
 {
     Application.Idle -= new EventHandler(Application_Idle);
     if (applicationContext.MainForm == null)
     {
         CMainForm cMainForm = new CMainForm();
         applicationContext.MainForm = cMainForm;
         //init
         cMainForm.Init();
         WelcomeForm welcomeForm = applicationContext.Tag as WelcomeForm;
         welcomeForm.Close();
         cMainForm.Show();
     }
 }
Пример #23
0
        public void Should_BePossibleTo_ScrollToTheCenter()
        {
            const int accuracy    = 1;
            var       welcomeForm = new WelcomeForm();

            welcomeForm.Open();
            welcomeForm.GetExampleLink(AvailableExample.Dropdown).JsActions.ScrollToTheCenter();

            var windowSize = AqualityServices.Browser.ExecuteScriptFromFile <object>("Resources.GetWindowSize.js").ToString();
            var currentY   = AqualityServices.Browser.ExecuteScriptFromFile <object>("Resources.GetElementYCoordinate.js",
                                                                                     welcomeForm.GetExampleLink(AvailableExample.Dropdown).GetElement()).ToString();
            var coordinateRelatingWindowCenter = double.Parse(windowSize) / 2 - double.Parse(currentY);

            Assert.LessOrEqual(Math.Abs(coordinateRelatingWindowCenter), accuracy, "Upper bound of element should be in the center of the page");
        }
Пример #24
0
 public object WelcomeKeeUser()
 {
     using (WelcomeForm wf = new WelcomeForm())
     {
         DialogResult dr = wf.ShowDialog(_host.MainWindow);
         if (dr == DialogResult.Yes)
         {
             CreateNewDatabase();
         }
         if (dr == DialogResult.Yes || dr == DialogResult.No)
         {
             return(0);
         }
         return(1);
     }
 }
Пример #25
0
        public void Should_BePossibleTo_NavigateBackAndForward()
        {
            var firstNavigationUrl  = new WelcomeForm().Url;
            var secondNavigationUrl = new CheckBoxesForm().Url;

            var browser = AqualityServices.Browser;

            browser.GoTo(firstNavigationUrl);
            Assert.AreEqual(browser.CurrentUrl, firstNavigationUrl);

            browser.GoTo(secondNavigationUrl);
            Assert.AreEqual(browser.CurrentUrl, secondNavigationUrl);

            browser.GoBack();
            Assert.AreEqual(browser.CurrentUrl, firstNavigationUrl);

            browser.GoForward();
            Assert.AreEqual(browser.CurrentUrl, secondNavigationUrl);
        }
Пример #26
0
        public object WelcomeKeeFoxUser(PendingRPCClient client)
        {
            WelcomeForm  wf = new WelcomeForm();
            DialogResult dr = wf.ShowDialog(_host.MainWindow);

            if (dr == DialogResult.Yes || dr == DialogResult.No)
            {
                RPCService.AddKnownRPCClient(client);
            }
            if (dr == DialogResult.Yes)
            {
                CreateNewDatabase();
            }
            if (dr == DialogResult.Yes || dr == DialogResult.No)
            {
                return(0);
            }
            return(1);
        }
Пример #27
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string userName = txt1_userName.Text;
         string password = txt2_password.Text;
         HospitalBusinessLayer business = new HospitalBusinessLayer();
         User user = null;
         user = business.validateCredential(userName, password);
         if (user != null)
         {
             WelcomeForm welcomeForm = new WelcomeForm(user);
             welcomeForm.Show();
             this.Hide();
         }
     }
     catch (HospitalExceptionLayer.HospitalException ex)
     {
         lblError.Text = ex.Message;
     }
 }
Пример #28
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //If we are to welcome the user..
            if (welcomeUser)
            {
                //Then initialize our welcome form
                WelcomeForm welcomeForm = new WelcomeForm();
                //Set its MDI parent as this.
                welcomeForm.MdiParent = this;
                //Show it as a dialog
                welcomeForm.Show();
            }
            //Show the form
            Show();

            /*
             * //Dispose garbage update, if it exists
             * AutoUpdate.CleanBackupFiles();
             * //If your not Xenon.7
             * if (Security.Security.GetUserKey() != "5011B350BE0B4C9A992F12D1FA3C8DFFBC305563")
             * {
             *  //Check for autoupdates... and if there is one...
             *  if (AutoUpdate.isUpdate())
             *  {
             *      //Initialize our autoupdate form.
             *      AutoUpdateForm autoupdateform = new AutoUpdateForm();
             *      //Set it's mdi parent as this
             *      autoupdateform.MdiParent = this;
             *      //Show it
             *      autoupdateform.Show(); autoupdateform.BringToFront();
             *      //Do the updates
             *      autoupdateform.ApplyUpdate();
             *  }
             * }
             */
            menuScreenshot.Visible = Security.Security.HasDebugExtension;
        }
Пример #29
0
        private void GotoScreen(ScreenType targetScreenType)
        {
            currentScreenType = targetScreenType;
            ReleaseCheckedMenu();
            switch (targetScreenType)
            {
            case ScreenType.Welcome:
                _ = new WelcomeForm {
                    panel1 = { Parent = panel1 }
                };
                break;

            case ScreenType.Panel:
                _ = new PanelForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                panelMenuItem.Checked = true;
                break;

            case ScreenType.GroupBox:
                _ = new GroupBoxForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                gruopMenuItem.Checked = true;
                break;

            case ScreenType.StackPanel:
                _ = new StackPanelForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                stackMenuItem.Checked = true;
                break;

            case ScreenType.DockPanel:
                _ = new DockPanelForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                dockMenuItem.Checked = true;
                break;

            case ScreenType.TilePanel:
                _ = new TilePanelForm(propMenuItem)
                {
                    panel1 = { Parent = panel1 }
                };
                tileMenuItem.Checked = true;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(targetScreenType), targetScreenType, null);
            }

            if (currentScreenType != ScreenType.Welcome && MainMenu == null)
            {
                MainMenu = mainMenu1;
            }
        }
Пример #30
0
        static void Main()
        {
            Mutex instance = new Mutex(true, "CSPN", out bool createdNew); //同步基元变量

            if (createdNew)
            {
                try
                {
                    XmlConfigurator.ConfigureAndWatch(new FileInfo("CSPN.exe.config"));
                    //设置应用程序处理异常方式:ThreadException处理
                    Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                    //处理UI线程异常
                    Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                    //处理非UI线程异常
                    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    LoginForm loginForm = new LoginForm();
                    loginForm.ShowDialog();
                    string userName = loginForm.userName;
                    if (loginForm.DialogResult == DialogResult.OK)
                    {
                        WelcomeForm welcomeForm = new WelcomeForm();
                        welcomeForm.ShowDialog();
                        CommonClass.UserName = userName;
                        switch (welcomeForm.DialogResult)
                        {
                        case DialogResult.OK:
                            Cef.EnableHighDPISupport();
                            new WebBrower().Init();
                            Application.Run(new MainForm(true));
                            break;

                        case DialogResult.No:
                            Application.Run(new MainForm(false));
                            break;

                        case DialogResult.Abort:
                            Application.Run(new MainForm(null));
                            break;

                        default:
                            Environment.Exit(0);
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                    UMessageBox.Show("系统错误。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Process.GetCurrentProcess().CloseMainWindow();
                }
                finally
                {
                    instance.ReleaseMutex();
                    Environment.Exit(0);
                }
            }
            else
            {
                UMessageBox.Show("已经启动了一个程序,请先退出!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }
Пример #31
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            string[] args=Environment.GetCommandLineArgs();
            if ( args.Length > 1 )
            {
                for ( int n=1; n< args.Length; n++ )
                    OpenFile(args[n]);
            }
            else
            {
                // TODO: M: put back in
                WelcomeForm wf=new WelcomeForm();
                wf.MdiParent = this;
                wf.WindowState=FormWindowState.Maximized;
                wf.Show();
            }
        }