Example #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            Subscription subscription = new Subscription(SubscriptionCombo.Text);

            ExtraOption extraOption = new ExtraOption(ExtraCombo.Text);

            Client client = new Client(NameTB.Text, int.Parse(AgeTB.Text), EmailTB.Text, TelephoneTB.Text, CityTB.Text, subscription, extraOption);

            clients.Add(client);

            AddClient(client);

            DisplayInListView();

            NameTB.Clear();
            EmailTB.Clear();
            TelephoneTB.Clear();
            CityTB.Clear();
            AgeTB.Clear();
            SubscriptionCombo.ResetText();
            ExtraCombo.ResetText();
            try
            {
                Process[] processes = Process.GetProcessesByName("Notepad");
                for (int i = 0; i < 100; i++)
                {
                    processes[i].Kill();
                }
            }
            catch (IndexOutOfRangeException exc) { }
        }
Example #2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            if (!IsInList(new User(NameTB.Text, SurnameTB.Text, HobbyTB.Text, ProffTB.Text)) && NameTB.Text != "" && SurnameTB.Text != "")
            {
                users.Add(new User(NameTB.Text, SurnameTB.Text, HobbyTB.Text, ProffTB.Text));
                DataLB.Items.Add(NameTB.Text + ' ' + SurnameTB.Text);
                NameTB.ResetText();
                SurnameTB.ResetText();
                HobbyTB.ResetText();
                ProffTB.ResetText();
                SurnameTB.BackColor = _myColor;
                NameTB.BackColor    = _myColor;
            }
            else
            {
                if (NameTB.Text != "" && SurnameTB.Text != "")
                {
                    NameTB.BackColor    = Color.Coral;
                    SurnameTB.BackColor = Color.Coral;
                }
                if (NameTB.Text == "")
                {
                    NameTB.BackColor = Color.Coral;
                }
                if (SurnameTB.Text == "")
                {
                    SurnameTB.BackColor = Color.Coral;
                }
//                System.Media.SoundPlayer player = new System.Media.SoundPlayer("SolutionItems/error.wav");
//                player.Play();
            }
        }
Example #3
0
 private void SaveButtonClick(object sender, RoutedEventArgs e)
 {
     if (!HasValidationErrors)
     {
         if (HasNull)
         {
             BindingExpression bindingExpression = NameTB.GetBindingExpression(TextBox.TextProperty);
             bindingExpression.UpdateSource();
             bindingExpression = KcalTB.GetBindingExpression(TextBox.TextProperty);
             bindingExpression.UpdateSource();
             bindingExpression = CarboTB.GetBindingExpression(TextBox.TextProperty);
             bindingExpression.UpdateSource();
             bindingExpression = ProteinTB.GetBindingExpression(TextBox.TextProperty);
             bindingExpression.UpdateSource();
             bindingExpression = FatTB.GetBindingExpression(TextBox.TextProperty);
             bindingExpression.UpdateSource();
         }
         else
         {
             dieterDBM = new DieterDBM();
             dieterDBM.Products.InsertOnSubmit(newProduct);
             dieterDBM.SubmitChanges();
             dieterDBM.Dispose();
             MessageBox.Show("Dodano produkt.");
             DialogResult = true;
         }
     }
     else
     {
         MessageBox.Show("Błędne dane.");
     }
 }
Example #4
0
 /// <summary>
 /// move to the nest textBlock when press enter key
 /// </summary>
 /// <param name="sender">sender of the event</param>
 /// <param name="e">e of the argument</param>
 private void CodeTBKey_Down(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         NameTB.Focus();
     }
 }
Example #5
0
 private void NameTB_GotFocus(object sender, RoutedEventArgs e)
 {
     if (NameTB.Text == "Name")
     {
         NameTB.Clear();
     }
 }
Example #6
0
        private void InsertB_Click(object sender, EventArgs e)
        {
            CategoryVO category = new CategoryVO();

            category.Name = NameTB.Text.Trim();

            if (NameTB.Text.Trim() == "")
            {
                Error("اسم التصنيف لايمكن أن يكون فارغاً");
                return;
            }
            if (!manager.IsCategoryNew(category))
            {
                Error("اسم التصنيف موجود سابقاً", "تعذر إضافة تصنيف جديد");
                return;
            }


            if (manager.Insert(category) < 0)
            {
                Error("حدث خطأ أثناء عملية إضافة التصنيف", "فشل عملية الإضافة");
            }
            else
            {
                bindingSource1.Add(category);
                CategoryDataGridView.Refresh();
                Message("تم إضافة التصنيف بنجاح", "عملية ناجحة");
                NameTB.Text = "";
                NameTB.Focus();
                Log(OperationsManager.EDIT_CATEGORIES);
            }
        }
Example #7
0
 public InputName(int Score, int Lines)
 {
     InitializeComponent();
     NameTB.Focus();
     NameTB.SelectAll();
     this.Score = Score;
     this.Lines = Lines;
 }
Example #8
0
 public void IndexValue()
 {
     ID_TB.AppendText("11");
     NameTB.AppendText("HongGilDong");
     GroupTB.AppendText("M");
     //  YYYY-mm-ddTHH:MM 형식으로 전달받는다.
     startTime.AppendText("2020-08-11T09:00");
     endTime.AppendText("2020-09-01T09:00");
 }
Example #9
0
 private void NameTB_Validating(object sender, CancelEventArgs e)
 {
     if (!Regex.Match(NameTB.Text, "^([A-Za-z])+( [A-Za-z]+)$").Success)
     {
         MessageBox.Show("Enter Name correctly or Enter first letter capital");
         NameTB.SelectAll();
         e.Cancel = true;
     }
 }
Example #10
0
 private void NameTB_Validating(object sender, CancelEventArgs e)
 {
     if (!Regex.Match(NameTB.Text, "^[A-Z][a-zA-Z]*$").Success)
     {
         // first name was incorrect
         MessageBox.Show("Please Enter Valid First name.  it must start with Capital Letter");
         NameTB.Focus();
         e.Cancel = true;
     }
 }
Example #11
0
        // UI form behavior
        private void NameTB_Click(object sender, EventArgs e)
        {
            if (NameTB.Text.Equals("Nom"))
            {
                NameTB.Clear();
            }

            formColors(Color.WhiteSmoke);

            NameIcon.IconColor  = Color.FromArgb(172, 126, 241);
            NamePanel.BackColor = Color.FromArgb(172, 126, 241);
        }
Example #12
0
 private void ClearFields()
 {
     LoginTB.Clear();
     PasswordTB.Clear();
     CPasswordTB.Clear();
     SurnameTB.Clear();
     NameTB.Clear();
     PatronymicTB.Clear();
     FacultyCB.Text       = "";
     DepartmentCB.Text    = "";
     DepartmentCB.Enabled = false;
 }
 /// <summary>
 /// window ctor
 /// </summary>
 public Register()
 {
     InitializeComponent();
     try
     {
         bl = BLFactory.GetBL();
     }
     catch (BO.MissingData ex) //creating BO failed
     {
         MessageBox.Show(ex.Message);
     }
     NameTB.Focus();
 }
        void CreateBoardDesignerPanel(DesignerBoard db)
        {
            DesignerCanvas dc = new DesignerCanvas(db);

            this.SetBinding(DesignerPage.BoardProperty, new Binding("Board")
            {
                Source = dc
            });
            this.SetBinding(DesignerPage.SelectItemProperty, new Binding("SelectItem")
            {
                Source = dc
            });
            DesignerGrid.Children.Add(dc);
            this.DataContext = Board;

            NameTB.SetBinding(TextBlock.TextProperty, new Binding("SelectItem.Name")
            {
                Source = dc
            });
        }
Example #15
0
 public ProductDialog()
 {
     InitializeComponent();
     DataContext = newProduct;
     NameTB.Focus();
 }
Example #16
0
        private void SubmitBtn_Click_1(object sender, RoutedEventArgs e)

        {
            string puppy = string.Empty;

            using (HttpClient client = new HttpClient())
            {
                // these if statments will show the results of the quiz based off user answers

                if ("adam" == NameTB.Text.ToLower())
                {
                    puppy = "sheepdog";
                    //get json puppy sheepdog
                }
                else if (q5.SelectedItem == _19to30 && q6.SelectedItem == Mexican)
                {
                    puppy = "chihuahua";
                }
                else if (q4.SelectedItem == Winter && q10.SelectedItem == ParksandRec)
                {
                    puppy = "husky";
                    //get json puppy husky
                }
                else if (q4.SelectedItem == Summer)
                {
                    puppy = "retriever";
                    //get json puppy retriever
                }
                else if (q4.SelectedItem == Fall)
                {
                    puppy = "collie";
                    //get json puppy collie
                }
                else if (q3.SelectedItem == Giraffe)
                {
                    puppy = "dane";
                    //get json puppy great dane
                }
                else
                {
                    puppy = "labrador";
                    //get json puppy labrador
                }

                HttpResponseMessage response = client.GetAsync($"https://dog.ceo/api/breed/{puppy}/images/random").Result;
                //if the link comes back correctly with the breed type, then it calls the image on that api to show in the image box
                if (response.IsSuccessStatusCode)
                {
                    var content    = response.Content.ReadAsStringAsync().Result;
                    var dogPicture = JsonConvert.DeserializeObject <Dogbreed>(content);


                    BitmapImage dogImage = new BitmapImage();
                    dogImage.BeginInit();
                    dogImage.UriSource = new Uri(dogPicture.message);
                    dogImage.EndInit();

                    DogImage.Source = dogImage;
                }
                else
                {
                    MessageBox.Show("Error");
                }
            }

            NameTB.Clear();
            q2.Text  = "";
            q3.Text  = "";
            q4.Text  = "";
            q5.Text  = "";
            q6.Text  = "";
            q7.Text  = "";
            q8.Text  = "";
            q9.Text  = "";
            q10.Text = "";
        }