Ejemplo n.º 1
0
        // Verifies that all input fields were filled in
        private bool CheckInputFields()
        {
            bool PersonalInfoComplete = true;
            bool StudiesInfoComplete  = true;
            bool TestSetChoosen       = true;

            // Check personal information are filled in
            if (txt_Name.Text == "" || txt_Surname.Text == "" || cmb_Gender.Text == "" || num_Age.Value == 0)
            {
                PersonalInfoComplete = false;
                // Display notification
                InfoTextBox.AppendText(Environment.NewLine + "Please fill in all Personal information fields.");
                InfoTextBox.AppendText(Environment.NewLine);
            }
            // Check if information about studies are filled in
            if (txt_Speciality.Text == "" || cmb_Year.Text == "")
            {
                StudiesInfoComplete = false;
                // Display notification
                InfoTextBox.AppendText(Environment.NewLine + "Please fill in information about your studies:");
                InfoTextBox.AppendText(Environment.NewLine + " - University and Degree are optional");
                InfoTextBox.AppendText(Environment.NewLine);
            }
            // Check if test set was chosen
            if (cmb_TestSet.Text == "")
            {
                TestSetChoosen = false;
                // Display notification
                InfoTextBox.AppendText(Environment.NewLine + "Please chose a test set indicated by the instructor.");
                InfoTextBox.AppendText(Environment.NewLine);
            }

            return(PersonalInfoComplete && StudiesInfoComplete && TestSetChoosen);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Acessing data on different Threads
 /// </summary>
 private void UpdateUI(string message)
 {
     Dispatcher.Invoke(() => {
         InfoTextBox.AppendText(message + Environment.NewLine);
         InfoTextBox.ScrollToEnd();
     });
 }
Ejemplo n.º 3
0
        private void UpdateUI(string message)
        {
            Func <int> del = delegate()
            {
                InfoTextBox.AppendText(message + Environment.NewLine);
                return(0);
            };

            Invoke(del);
        }
Ejemplo n.º 4
0
        private void start()
        {
            StartButton.Enabled   = false;
            InfoProgressBar.Value = CountPositionNumberInt;
            InfoTextBox.AppendText("当前破解次数:" + (CountPositionNumberInt + 1) + "\n");
            InfoTextBox.AppendText("当前破解账号:" + UserListBox.Items[UserPositionNumberInt].ToString() + "\n");
            InfoTextBox.AppendText("当前尝试密码:" + PassListBox.Items[PassPositionNumberInt].ToString() + "\n");

            Http.Post(LinkString)
            .Form(new { USERNAME = UserListBox.Items[UserPositionNumberInt].ToString(), PASSWORD = PassListBox.Items[PassPositionNumberInt].ToString() })
            .OnSuccess(result =>
            {
                if (result.Contains("<head id"))
                {
                    InfoTextBox.AppendText("当前破解状态:Success\n");
                    SuccessListBox.Items.Add(UserListBox.Items[UserPositionNumberInt].ToString() + " | " + PassListBox.Items[PassPositionNumberInt].ToString());
                }
                else
                {
                    InfoTextBox.AppendText("当前破解状态:Failure\n");
                }
                if (UserPositionNumberInt == (UserNumberInt - 1))
                {
                    if (PassPositionNumberInt == (PassNumberInt - 1))
                    {
                        InfoProgressBar.Value = CountNumberInt;
                        InfoTextBox.AppendText("破解已完成!");
                        StartButton.Enabled = true;
                        return;
                    }
                }
                if (PassPositionNumberInt == (PassNumberInt - 1))
                {
                    UserPositionNumberInt++;
                    PassPositionNumberInt = 0;
                }
                else
                {
                    PassPositionNumberInt++;
                }
                if (CountPositionNumberInt != (CountNumberInt - 1))
                {
                    CountPositionNumberInt++;
                    start();
                }
            })
            .OnFail(result =>
            {
                InfoTextBox.AppendText("当前破解状态:Network Failure,Try retry\n");
                start();
            })
            .Go();
        }
Ejemplo n.º 5
0
 public void GetMessage(string message)
 {
     if (InfoTextBox.InvokeRequired)
     {
         InfoTextBox.BeginInvoke(new MethodInvoker(() =>
         {
             InfoTextBox.AppendText(message + "\r\n");
         }));
     }
     else
     {
         InfoTextBox.AppendText(message + "\r\n");
     }
 }
Ejemplo n.º 6
0
 private void Info_btn_Click(object sender, EventArgs e)
 {
     try
     {
         InfoTextBox.Text = "";
         string[] phonesInfo = phones.PrintInfo();
         for (int i = 0; i < phonesInfo.Length; i++)
         {
             InfoTextBox.AppendText(phonesInfo[i]);
         }
     }
     catch
     {
         FormsUtils.ErrorMessageBox("Error");
     }
 }
Ejemplo n.º 7
0
 private void NameStarButton_Click(object sender, EventArgs e)
 {
     try
     {
         InfoTextBox.Text = "";
         string[] name = SpaceObjects.PrintNameStars();
         for (int i = 0; i < name.Length; i++)
         {
             InfoTextBox.AppendText(name[i]);
         }
     }
     catch
     {
         FormsUtils.ErrorMessageBox("Error");
     }
 }
Ejemplo n.º 8
0
 private void PlanetsInfoButton_Click(object sender, EventArgs e)
 {
     try
     {
         InfoTextBox.Text = "";
         string[] planetsInfo = SpaceObjects.PrintInfoPlanets();
         for (int i = 0; i < planetsInfo.Length; i++)
         {
             InfoTextBox.AppendText(planetsInfo[i]);
         }
     }
     catch
     {
         FormsUtils.ErrorMessageBox("Error");
     }
 }
Ejemplo n.º 9
0
        private void About_Form_Load(object sender, EventArgs e)
        {
            AboutTextBox.Text = "Copyright 2020 Autodesk, Inc. All rights reserved. " +
                                "\r\n\r\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" +
                                "\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," +
                                "\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" +
                                "\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" +
                                "\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," +
                                "\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +
                                "\r\n\r\nAutodesk" +
                                "\r\nCustomer Services Organisation" +
                                "\r\nFarnborough" +
                                "\r\nFernando Pavon" +
                                "\r\[email protected]" +
                                "\r\nVersion 0.0.0.1" +
                                "\r\n1 July 2020";

#if (Revit2018)
            revitVersion = "Revit Version 2018";
#elif (Revit2019)
            revitVersion = "Revit Version 2019";
#elif (Revit2020)
            revitVersion = "Revit Version 2020";
#endif
            InfoTextBox.AppendText("\u2022Revit Version: " + Utils.k_revitVersion);
            InfoTextBox.AppendText("\r\n\r\n\u2022Revit Language: " + Utils.k_revitLanguage);
            InfoTextBox.AppendText("\r\n\r\n\u2022System Country: " + Utils.k_systemCountry);
            InfoTextBox.AppendText("\r\n\r\n\u2022System Language: " + Utils.k_systemLanguage);

            //VersionsTextBox.AppendText("\u2022" + revitVersion);

            string strGeo = string.Empty;

            foreach (AssemblyVersion assembly in Utils.s_assemblies)
            {
                if (assembly.Geography != "")
                {
                    strGeo = assembly.Geography;
                }
                else
                {
                    strGeo = "";
                }
                string line = "\u2022" + assembly.AssemblyName + "  Version: " + assembly.CurrentVersion + " " + strGeo + "\r\n\r\n";
                VersionsTextBox.AppendText(line);
            }
        }
Ejemplo n.º 10
0
        // Submit button action
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            string UserIdData;

            // Clear notification area content
            InfoTextBox.Clear();

            // If all information is complete
            if (CheckInputFields())
            {
                // Populate information about the test subject
                TestSubject.Name    = txt_Name.Text;
                TestSubject.Surname = txt_Surname.Text;
                TestSubject.Gender  = cmb_Gender.Text;
                TestSubject.Age     = num_Age.Value.ToString();
                TestSubject.Spec    = txt_Speciality.Text;
                TestSubject.Uni     = txt_University.Text;
                TestSubject.Year    = cmb_Year.Text;
                TestSubject.Deg     = cmb_Degree.Text;
                // Calculate unique user ID
                UserIdData     = TestSubject.Name + TestSubject.Surname + DateTime.Now.ToString();
                TestSubject.Id = Math.Abs(UserIdData.GetHashCode()).ToString();
                // Populate test data
                TestData.TestSet  = cmb_TestSet.Text;
                TestData.DateTime = DateTime.Now.ToString();
                // Get all directories of the test sets
                TestSetPathList = Directory.GetDirectories(@"Pictures\" + TestData.TestSet + "\\");
                // Enable test controls
                btn_Start.Enabled = true;
                // Disable Submit button
                btn_Submit.Enabled = false;
                // Disable Personal Information, Studies and Test Set group box
                PersonalInfo.Enabled = false;
                Studies.Enabled      = false;
                TestSet.Enabled      = false;
                // Create user file
                PrepareOutputFile();
                // Clear notification area
                InfoTextBox.Clear();
                // Display notification
                InfoTextBox.AppendText(Environment.NewLine + "Please press the Start button to enter the Demo trial.");
                InfoTextBox.AppendText(Environment.NewLine);
            }
        }
Ejemplo n.º 11
0
 // Submit Solution button action
 private void SubmitSolutionButton_Click(object sender, EventArgs e)
 {
     // If solution fields were filled in
     if (txt_Category.Text != "" && txt_Description.Text != "")
     {
         // Don't do for DEMO set
         if (IdxSet != 0)
         {
             // Get trial time in 100ms
             TestData.TrialTime = Time.GetTrialTime_100ms();
             // Save image index
             TestData.TrialStep = IdxImg;
             // Save trial Name and Category
             TestData.TrialType = txt_Category.Text;
             TestData.TrialName = txt_Description.Text;
             // Write trial results to file
             WriteTrialResultToFile();
         }
         // Clear input fields
         txt_Category.Clear();
         txt_Description.Clear();
         // Disable Category and Name input fields
         txt_Category.Enabled    = false;
         txt_Description.Enabled = false;
         // Disable Submit button
         btn_Complete.Enabled = false;
         // Enable Next Trial button
         btn_NextTrial.Enabled = true;
         // Clear notification area
         InfoTextBox.Clear();
     }
     else
     {
         // Clear notification area
         InfoTextBox.Clear();
         // Display notification
         InfoTextBox.AppendText(Environment.NewLine + "Please fill in both Name and Category fields before you press Submit!");
     }
 }
Ejemplo n.º 12
0
        public MainWindow()
        {
            InitializeComponent();

            Updater.ProgressChanged += ((sender, args) =>
            {
                Dispatcher.Invoke(() =>
                {
                    var idle = args.Status is UpdaterStatus.Ready or UpdaterStatus.Complete;
                    UpdateButton.IsEnabled = idle;
                    CancelButton.IsEnabled = !idle;

                    if (Updater.IsCancelled && !idle)
                    {
                        return;
                    }

                    DownloadStatus.Text = args.Status.ToString();

                    var progress = args.Progress;
                    PercentText.Text = progress >= 0 ? $"{Math.Round(progress * 100, 2)}%" : null;
                    ProgressBar.IsIndeterminate = progress < 0;
                    ProgressBar.Value = Math.Max(0, progress);
                });
            });

            Updater.InfoSent += ((sender, s) =>
            {
                Dispatcher.Invoke(() =>
                {
                    InfoTextBox.AppendText(s);
                    InfoTextBox.AppendText("\n");
                });
            });

            Updater.ErrorOccurred += Updater_ErrorOccurred;
        }
Ejemplo n.º 13
0
 private void AppendToInfoBox(int i, string header, string data)
 {
     InfoTextBox.AppendText($"\n{i} {header} : {data}");
 }