private bool IsWrongTextBoxValue()
        {
            bool flag = false;

            foreach (TextBox item in ElementsModification.FindVisualChildren <TextBox>(this))
            {
                if (item.Text == "")
                {
                    item.BorderBrush = ColorPalette.GetPredefinedColor(PredefinedColors.Blood);
                    flag             = true;
                }
                if (!uint.TryParse(item.Text, out uint _) & item.Name != "NameTextBox")
                {
                    item.BorderBrush = ColorPalette.GetPredefinedColor(PredefinedColors.Blood);
                    flag             = true;
                }
            }
            foreach (ComboBox item in ElementsModification.FindVisualChildren <ComboBox>(this))
            {
                if (item.Items.IsEmpty)
                {
                    flag = true;
                }
            }
            return(flag);
        }
Esempio n. 2
0
        private void ImportExcel_Click(object sender, RoutedEventArgs e)
        {
            string[,] data = ExcelFileTools.UploadExcelData();
            if (data?.GetLength(1) >= ElementsModification.FindVisualChildren <GridViewColumnHeader>(this).Count() - 2)
            {
                for (int i = 0; i < data.GetLength(0); i++)
                {
                    int.TryParse(data[i, 1], out int complexity);

                    var subject = new SchoolSubject(data[i, 0], complexity);
                    SchoolSubjectDict.dictionaryList.Add(subject);
                    SubjectsList.Items.Add(subject);
                }
                (Owner as EditorWindow).HomePage.SubjectsIndicator.Fill = ColorPalette.GetPredefinedColor(PredefinedColors.Green);
            }
            else if (data?.GetLength(1) < ElementsModification.FindVisualChildren <GridViewColumnHeader>(this).Count() - 2)
            {
                MessageBox.Show("Wrong Columns Format");
            }
        }
        private void ImportExcel_Click(object sender, RoutedEventArgs e)
        {
            string[,] data = ExcelFileTools.UploadExcelData();
            // HACK: Change Length Checker
            if (data?.GetLength(1) > ElementsModification.FindVisualChildren <GridViewColumnHeader>(this).Count() - 2)
            {
                for (int i = 0; i < data.GetLength(0); i++)
                {
                    DateTime.TryParse(data[i, 1], out DateTime start);
                    DateTime.TryParse(data[i, 2], out DateTime end);

                    var period = new SchoolPeriod(data[i, 0], start, end);
                    StudyPeriodDict.dictionaryList.Add(period);
                    PeriodsList.Items.Add(period);
                }
            }
            else if (data?.GetLength(1) < ElementsModification.FindVisualChildren <GridViewColumnHeader>(this).Count() - 2)
            {
                MessageBox.Show("Wrong Columns Format");
            }
        }