Exemplo n.º 1
0
        /// <summary>
        /// Проверяем значение полей структуры и приводим их в значение по умолчнию, если они не инициализированы
        /// </summary>
        public void CheckAndToDefault()
        {
            if (string.IsNullOrEmpty(CompDir))
            {
                CompDir = "";
            }

            if (GridLinesFontStyle == null)
            {
                GridLinesFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["DataGridLinesBrush"] as SolidColorBrush).Color,
                };
            }

            if (PlainResultsFontStyle == null)
            {
                PlainResultsFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["PlainResultsBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["PlainResultsForeBrush"] as SolidColorBrush).Color
                };
            }

            if (NextRoundMembersCountFontStyle == null)
            {
                NextRoundMembersCountFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["NextRoundMembersCountBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["NextRoundMembersCountForeBrush"] as SolidColorBrush).Color
                };
            }

            if (InvitedToStartFontStyle == null)
            {
                InvitedToStartFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["InvitedToStartBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["InvitedToStartForeBrush"] as SolidColorBrush).Color
                };
            }

            if (PreparingFontStyle == null)
            {
                PreparingFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["PreparingBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["PreparingForeBrush"] as SolidColorBrush).Color
                };
            }

            if (StayOnStartFontStyle == null)
            {
                StayOnStartFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["StayOnStartBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["StayOnStartForeBrush"] as SolidColorBrush).Color
                };
            }

            if (JustRecievedResultFontStyle == null)
            {
                JustRecievedResultFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["JustRecievedResultBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["JustRecievedResultForeBrush"] as SolidColorBrush).Color
                };
            }

            if (FalsestartFontStyle == null)
            {
                FalsestartFontStyle = new CFontStyleSettings()
                {
                    BackgroundColor = (m_GlobalResources["FalsestartBrush"] as SolidColorBrush).Color,
                    ForeColor       = (m_GlobalResources["FalsestartForeBrush"] as SolidColorBrush).Color
                };
            }

            if (string.IsNullOrEmpty(FontFamilyName))
            {
                FontFamilyName = "Arial";
            }

            if (dictFileScannerSettings == null)
            {
                dictFileScannerSettings = new SerializableDictionary <string, CFileScannerSettings>();
            }

            if (dictCompSettings == null)
            {
                dictCompSettings = new SerializableDictionary <long, CCompSpecificSets>();
            }
            else
            {
                foreach (KeyValuePair <long, CCompSpecificSets> Item in dictCompSettings)
                {
                    Item.Value.CheckAndToDefault();
                }
                foreach (KeyValuePair <long, CCompSpecificSets> ItemToDel in
                         new List <KeyValuePair <long, CCompSpecificSets> >(dictCompSettings.Where(arg => arg.Value.CompId == GlobalDefines.DEFAULT_XML_INT_VAL)))
                {
                    dictCompSettings.Remove(ItemToDel.Key);
                }
            }

            if (DefaultCompSettings == null)
            {
                DefaultCompSettings = new CCompSpecificSets()
                {
                    WomenInGroup                  = 3,
                    MenInGroup                    = 3,
                    LeadReportXlsPath             = null,
                    FirstMemberRow                = 8,
                    PlaceColumnIndex              = 1,
                    PersonalDataColumnIndex       = 2,
                    PersRepPlaceAggregationMethod = enPersRepPlacesAggregationMethod.Sum,
                    PersRepWinnerDetection        = enPersRepWinnerDetection.LeadPriority
                };
            }

            if (ExcelSettings == null)
            {
                ExcelSettings = new CExcelSettings();
                ExcelSettings.ToDefault();
            }
            else
            {
                ExcelSettings.CheckAndToDefault();
            }

            if (string.IsNullOrEmpty(MySQLBatFullPath))
            {
                MySQLBatFullPath = "D:\\Саша\\Документы\\Эксель\\Для соревнований\\Скалолазание\\Скорость Last Edition\\БД\\RunMySQLServer.lnk";
            }

            if (string.IsNullOrEmpty(WorkbookTemplateFolder))
            {
                WorkbookTemplateFolder = "D:\\Саша\\Документы\\Эксель\\Для соревнований\\Скалолазание\\Скорость Last Edition";
            }

            if (string.IsNullOrEmpty(WorkbookTemplateName))
            {
                WorkbookTemplateName = "Таблица Скорость Новая.xlsm";
            }

            if (string.IsNullOrEmpty(CompetitionsFolder))
            {
                CompetitionsFolder = "D:\\Саша\\Документы\\Эксель\\Для соревнований\\Скалолазание";
            }

            if (FilesToCopyFromWorkbookTemplateFolder == null)
            {
                FilesToCopyFromWorkbookTemplateFolder = new string[]
                {
                    "Таблица Скорость Новая.xlsm",
                    "Таблица флагов и горячих клавиш (Скорость).doc",

                    "FI.txt",
                    "data.txt",

                    @"GroupDefiner\GroupDefiner.exe",
                    @"OpenSecondQualif\OpenSecondQualif.exe",

                    @"StopWatchScan\borlndmm.dll",
                    @"StopWatchScan\CC3260MT.DLL",
                    @"StopWatchScan\ErrorCOMLog.txt",
                    @"StopWatchScan\PrjStopWatchScan.exe",
                    @"StopWatchScan\ResultLog.txt",
                    @"StopWatchScan\UsingCOM.txt",
                    @"StopWatchScan\PrjStopWatchScan.exe",
                };
            }

            if (AvailableGroupNames == null || AvailableGroupNames.Length == 0)
            {
                AvailableGroupNames = new CAvailableGroupName[]
                {
                    new CAvailableGroupName("Мужчины", enSex.Male, false, 0),
                    new CAvailableGroupName("Юниоры", enSex.Male, true, 0),
                    new CAvailableGroupName("Младшие юноши", enSex.Male, true, 1),
                    new CAvailableGroupName("Старшие юноши", enSex.Male, true, 2),
                    new CAvailableGroupName("Подростки мальчики", enSex.Male, true, 3),
                    new CAvailableGroupName("Суперподростки мальчики", enSex.Male, true, 4),
                    new CAvailableGroupName("Мальчики", enSex.Male, true, 5),

                    new CAvailableGroupName("Женщины", enSex.Female, false, 0),
                    new CAvailableGroupName("Юниорки", enSex.Female, true, 0),
                    new CAvailableGroupName("Младшие девушки", enSex.Female, true, 1),
                    new CAvailableGroupName("Старшие девушки", enSex.Female, true, 2),
                    new CAvailableGroupName("Подростки девочки", enSex.Female, true, 3),
                    new CAvailableGroupName("Суперподростки девочки", enSex.Female, true, 4),
                    new CAvailableGroupName("Девочки", enSex.Female, true, 5),
                };
            }

            if (MinAgeToCalcResultGrade <= 0)
            {
                MinAgeToCalcResultGrade = 10;
            }
        }
Exemplo n.º 2
0
        public void ToDefault()
        {
            CompDir               = "";
            HandleFileDeletion    = AutodetectOnStart = true;
            ResultGradeCalcMethod = enResultGradeCalcMethod.Floor;

            DefaultCompSettings = new CCompSpecificSets()
            {
                WomenInGroup                  = 3,
                MenInGroup                    = 3,
                LeadReportXlsPath             = null,
                FirstMemberRow                = 8,
                PlaceColumnIndex              = 1,
                PersonalDataColumnIndex       = 2,
                YearOfBirthColumnIndex        = 4,
                TeamColumnIndex               = 3,
                PersRepPlaceAggregationMethod = enPersRepPlacesAggregationMethod.Sum,
                PersRepWinnerDetection        = enPersRepWinnerDetection.LeadPriority
            };

            GridLinesFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["DataGridLinesBrush"] as SolidColorBrush).Color,
            };
            PlainResultsFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["PlainResultsBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["PlainResultsForeBrush"] as SolidColorBrush).Color
            };
            NextRoundMembersCountFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["NextRoundMembersCountBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["NextRoundMembersCountForeBrush"] as SolidColorBrush).Color
            };
            InvitedToStartFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["InvitedToStartBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["InvitedToStartForeBrush"] as SolidColorBrush).Color
            };
            PreparingFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["PreparingBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["PreparingForeBrush"] as SolidColorBrush).Color
            };
            StayOnStartFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["StayOnStartBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["StayOnStartForeBrush"] as SolidColorBrush).Color
            };
            JustRecievedResultFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["JustRecievedResultBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["JustRecievedResultForeBrush"] as SolidColorBrush).Color
            };
            FalsestartFontStyle = new CFontStyleSettings()
            {
                BackgroundColor = (m_GlobalResources["FalsestartBrush"] as SolidColorBrush).Color,
                ForeColor       = (m_GlobalResources["FalsestartForeBrush"] as SolidColorBrush).Color
            };

            FontSize       = 14.0;
            FontFamilyName = "Arial";

            dictFileScannerSettings = new SerializableDictionary <string, CFileScannerSettings>();

            dictCompSettings = new SerializableDictionary <long, CCompSpecificSets>();

            ExcelSettings = new CExcelSettings();
            ExcelSettings.ToDefault();

            MySQLBatFullPath = null;

            WorkbookTemplateFolder = null;
            WorkbookTemplateName   = null;
            CompetitionsFolder     = null;
            FilesToCopyFromWorkbookTemplateFolder = null;

            //AvailableGroupNames = null;

            Only75PercentForCalcGrades = false;
            MinAgeToCalcResultGrade    = 10;

            GodsMode = false;
        }