Exemple #1
0
        /// <summary>
        /// Click evet, Save the curret loaded config file for the other events in the program.
        /// </summary>
        private void subSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.SettingsRichTextBox.Text) || string.IsNullOrWhiteSpace(this.SettingsRichTextBox.Text))
            {
                Alert.AlertCreation("Load Something!", AlertType.error);
                return;
            }
            else
            {
                string executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string configLocation     = Path.Combine(executableLocation, "UI_TFS_ServerOperation.exe.config");

                TextWriter writer = new StreamWriter(configLocation);

                writer.Write(SettingsRichTextBox.Text);
                writer.Close();

                try
                {
                    ConfigurationManager.RefreshSection("PBICollectionSection");
                    ConfigurationManager.RefreshSection("Connection");
                    ConfigurationManager.RefreshSection("MailInformation");
                    ConfigurationManager.RefreshSection("system.diagnostics");

                    // Controller ReInit
                    informationParser = new InformationParser();
                    log            = informationParser.Init_Log();
                    serverOperator = informationParser.Init_ServerOperation(log);
                    mailSender     = informationParser.Init_MailSender(log);

                    // Server information setting to the Upload page
                    ServerCollectionInfoLabel.Text  = informationParser.CurrentTfsCollectionName;
                    ServerTeamProjectInfoLabel.Text = informationParser.CurrentTeamProjectName;
                    UploadActiveButton.Text         = "Active";
                    UploadActiveButton.ForeColor    = Color.SeaGreen;
                    ServerCollectionInfoLabel.Refresh();
                    ServerTeamProjectInfoLabel.Refresh();
                    UploadActiveButton.Refresh();
                    FileRichTextBox.Clear();
                    LogRichTextBox.Clear();
                }
                catch (Exception)
                {
                    log.Error("Server connection fail!");
                    log.Flush();
                    ServerCollectionInfoLabel.Text  = "Fail";
                    ServerTeamProjectInfoLabel.Text = "Fail";
                    UploadActiveButton.Text         = "Inactive";
                    UploadActiveButton.ForeColor    = Color.Red;
                    Alert.AlertCreation("Server connection fail!", AlertType.error);
                }
                Alert.AlertCreation("Save Success!", AlertType.success);
            }
        }
Exemple #2
0
        public void Init_Log_Success()
        {
            // Arrange
            InformationParser informationParser = new InformationParser();

            // Act
            Logger result = informationParser.Init_Log();

            // Assert
            Assert.IsTrue(typeof(Object).IsInstanceOfType(result));
        }
Exemple #3
0
        public subMenu()
        {
            InitializeComponent();
            if (Program.isInDesignMode())
            {
                return;
            }

            try
            {
                // Controller Init
                informationParser = new InformationParser();
                log            = informationParser.Init_Log();
                serverOperator = informationParser.Init_ServerOperation(log);
                mailSender     = informationParser.Init_MailSender(log);

                // Server information setting to the Upload page
                ServerCollectionInfoLabel.Text  = informationParser.CurrentTfsCollectionName;
                ServerTeamProjectInfoLabel.Text = informationParser.CurrentTeamProjectName;
            }
            catch (Exception)
            {
                ServerCollectionInfoLabel.Text  = "Fail";
                ServerTeamProjectInfoLabel.Text = "Fail";
                UploadActiveButton.Text         = "Inactive";
                UploadActiveButton.ForeColor    = Color.Red;
                Alert.AlertCreation("Configure your Settings!", AlertType.info);
            }

            //BarLabel init part
            UploadBar.LabelVisible                  = true;
            OneElemDeleteBar.LabelVisible           = true;
            MoreElemDeleteBar.LabelVisible          = true;
            FileDeleteProgressBar.LabelVisible      = true;
            AllServerDeleteProgressBar.LabelVisible = true;

            VSReactive <int> .Subscribe("menu", e => tabControl1.SelectedIndex = e);

            VSReactive <int> .Subscribe("ContentControllerPages", e => ContentControllerPages.SelectedIndex = e);
        }