예제 #1
0
 private void CMessageBoxEx_Loaded(object sender, RoutedEventArgs e)
 {
     if (AddedStdButtons != null)
     {
         GlobalDefines.MakeButtonsSameWidth(AddedStdButtons);
     }
 }
예제 #2
0
        private void RefreshRounds()
        {
            cmbRounds.SelectionChanged -= cmbRounds_SelectionChanged;

            cmbRounds.Items.Clear();

            foreach (var round in m_mainWnd.CurrentRounds)
            {
                var cmbi = GlobalDefines.AddItemToCmb <byte>(cmbRounds, round.Value.Value.Name, round.Key);

                if (m_mainWnd.CurrentRounds.SelectedKey == round.Key)
                {
                    cmbRounds.SelectedItem = cmbi;
                }
            }

            if (m_mainWnd.CurrentRounds.Count == 0)
            {
                GlobalDefines.AddItemToCmb <byte>(cmbRounds, Properties.Resources.resSelectRound, 255);
                cmbRounds.SelectedIndex = 0;
            }

            OnPropertyChanged(RoundSelectionEnabledPropertyName);

            cmbRounds.Width = double.NaN;
            GlobalDefines.TuneComboboxWidth2(cmbRounds);

            cmbRounds.SelectionChanged += cmbRounds_SelectionChanged;
        }
예제 #3
0
        /// <summary>
        /// Запуск формы в другом потоке
        /// </summary>
        /// <param name="hFinishedSearchEvent">
        /// Событие, установка которого закрывает окно
        /// </param>
        /// <param name="th">
        /// Поток, в котором создаётся окно
        /// </param>
        /// <param name="WndTitle"></param>
        /// <param name="WndText"></param>
        public static int ShowAsync(out AutoResetEvent hFinishedSearchEvent, out Thread th, string WndTitle, string WndText, Window OwnerWindow)
        {
            hFinishedSearchEvent = new AutoResetEvent(false);
            th = new Thread(ShowAsyncThreadFunc)
            {
                IsBackground = true
            };

            if (m_csShowCounter.Value > 0)
            {
                return(0);
            }

            m_csShowCounter++;

            CShowAsyncParam ThreadParam = new CShowAsyncParam()
            {
                m_ID = NextWndID,
                m_hFinishedSearchEvent = hFinishedSearchEvent,
                m_WndTitle             = WndTitle,
                m_WndText     = WndText,
                m_OwnerWindow = OwnerWindow
            };

            th.SetApartmentState(ApartmentState.STA);
            th.Start(ThreadParam);

            GlobalDefines.DoEvents(DBManagerApp.MainWnd); // Чтобы не зависла главная форма и в её заголовке не было написано "(Не отвечает)"

            return(NextWndID++);
        }
예제 #4
0
        private void btnRemoveGrades_Click(object sender, RoutedEventArgs e)
        {
            if (GlobalDefines.IsRoundFinished(DBManagerApp.m_Entities.groups.First(arg => arg.id_group == m_GroupId).round_finished_flags, enRounds.Final))
            {   // Можно расставить разряды, т.к. соревы закончились
                List <participations> Members = (from member in DBManagerApp.m_Entities.members
                                                 join part in DBManagerApp.m_Entities.participations on member.id_member equals part.member
                                                 where part.Group == m_GroupId
                                                 orderby part.result_place
                                                 select part).ToList();

                foreach (participations part in Members)
                {
                    part.result_grade = null;
                }

                DBManagerApp.m_Entities.SaveChanges();

                MessageBox.Show(this,
                                Properties.Resources.resGradesRemoved,
                                Title,
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);

                GradesChangedFromOpen = true;
            }
            else
            {
                MessageBox.Show(this, Properties.Resources.resCantSetGrades, Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #5
0
        private void AddItemToLog(CLogItem LogItem, CQueueItem Item)
        {
            GlobalDefines.CheckPublishingDirExists();

            string Dir = GlobalDefines.STD_PUBLISHING_LOG_DIR + Item.CompId.ToString() + "\\";

            if (!Directory.Exists(Dir))
            {
                Directory.CreateDirectory(Dir);
            }

            try
            {
                using (TextWriter tw = new StreamWriter(string.Format("{0}{1}\\{2}{3}",
                                                                      GlobalDefines.STD_PUBLISHING_LOG_DIR,
                                                                      Item.CompId,
                                                                      Item.GroupId,
                                                                      GlobalDefines.PUBLISHING_LOG_FILE_EXTENSION), true))
                {
                    tw.WriteLine(LogItem.ToLogFileString());
                }
            }
            catch (Exception ex)
            {
                ex.ToString(); // make compiler happy
            }
        }
예제 #6
0
        private void RefreshGroups()
        {
            cmbGroups.SelectionChanged -= cmbGroups_SelectionChanged;

            cmbGroups.Items.Clear();

            foreach (var group in m_mainWnd.CurrentGroups)
            {
                var cmbi = GlobalDefines.AddItemToCmb <long>(cmbGroups, group.Value.Value.AgeGroup.FullGroupName, group.Key);

                if (m_mainWnd.CurrentGroups.SelectedKey == group.Key)
                {
                    cmbGroups.SelectedItem = cmbi;
                }
            }

            if (m_mainWnd.CurrentGroups.Count == 0)
            {
                GlobalDefines.AddItemToCmb <long>(cmbGroups, Properties.Resources.resSelectGroup, -1);
                cmbGroups.SelectedIndex = 0;
            }

            OnPropertyChanged(GroupSelectionEnabledPropertyName);

            cmbGroups.Width = double.NaN;
            GlobalDefines.TuneComboboxWidth2(cmbGroups);

            cmbGroups.SelectionChanged += cmbGroups_SelectionChanged;
        }
        private bool RefreshItems(string FullFilePath = null)
        {
            if (FullFilePath == null)
            {
                Comps.Clear();

                GlobalDefines.CheckPublishingDirExists();

                foreach (string Dir in Directory.EnumerateDirectories(GlobalDefines.STD_PUBLISHING_LOG_DIR))
                {
                    try
                    {
                        foreach (string FullPath in Directory.EnumerateFiles(Dir))
                        {
                            HandleFile(FullPath);
                        }
                    }
                    catch
                    { }
                }
                return(true);
            }
            else
            {
                return(HandleFile(FullFilePath));
            }
        }
예제 #8
0
        public void SetTime(ref string ExcelTime)
        {
            ExcelTime = ExcelTime.Trim();
            enAdditionalEventTypes EventType;

            Time = GlobalDefines.RouteResultToTime(ExcelTime, out EventType);

            if (EventType != enAdditionalEventTypes.None)
            {
                if (AdditionalEventTypes.HasValue)
                {
                    AdditionalEventTypes = (AdditionalEventTypes & ~(enAdditionalEventTypes.DontAppear | enAdditionalEventTypes.Disqualif)) | EventType;
                }
                else
                {
                    AdditionalEventTypes = EventType;
                }
            }
            else
            {
                if (AdditionalEventTypes.HasValue)
                {
                    AdditionalEventTypes = AdditionalEventTypes & ~(enAdditionalEventTypes.DontAppear | enAdditionalEventTypes.Disqualif);
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Данная функция не заполняет поля result_grade и result_place
        /// </summary>
        /// <param name="MemberId"></param>
        /// <param name="GroupId"></param>
        /// <param name="SecondColNameType"></param>
        /// <returns></returns>
        public participations ToParticipation(long MemberId, long GroupId, enSecondColNameType SecondColNameType)
        {
            participations result = new participations()
            {
                member = MemberId,
                Group  = GroupId,
            };

            if (GradeInEnum != enGrade.None)
            {
                result.init_grade = (byte)GradeInEnum;
            }

            switch (SecondColNameType)
            {
            case enSecondColNameType.Coach:
                result.coach = GlobalDefines.GetCoachId(SecondCol, true);
                break;

            case enSecondColNameType.Team:
            default:            // по умолчанию будет "команда"
                result.team = GlobalDefines.GetTeamId(SecondCol, true);
                break;
            }

            return(result);
        }
예제 #10
0
        public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            string result = "";

            switch (values.Length)
            {
            case 1:
                result = GlobalDefines.PlaceToString((int?)values[0]);
                break;

            case 2:
                result = GlobalDefines.PlaceToString((int?)values[0]);
                if (!string.IsNullOrEmpty(result))
                {
                    string PlaceInFilter = GlobalDefines.PlaceToString((int?)values[1]);
                    if (!string.IsNullOrEmpty(PlaceInFilter))
                    {
                        result += " (" + PlaceInFilter + ")";
                    }
                }
                break;
            }

            return(result);
        }
예제 #11
0
        private void Results_StyleChanged(object sender, StyleChangedEventArgs e)
        {
            OnStyleChanged(e);
            CResult ResultHasBeenChanged = e.Source as CResult;

            if (ResultHasBeenChanged != null && e.PropertyName == CResult.AdditionalEventTypesPropertyName)
            {
                FalstartsRulesRange Range = GlobalDefines.GetFalstartsRulesRange(ResultHasBeenChanged.ResultInDB.participations.Group,
                                                                                 ResultHasBeenChanged.ResultInDB.round);

                List <members> MembersWithFalsestarts = (from member in DBManagerApp.m_Entities.members
                                                         join part in DBManagerApp.m_Entities.participations on member.id_member equals part.member
                                                         join result in DBManagerApp.m_Entities.results_speed on part.id_participation equals result.participation
                                                         where result.round >= Range.StartRound &&
                                                         result.round <= Range.EndRound &&
                                                         part.Group == ResultHasBeenChanged.ResultInDB.participations.Group &&
                                                         ((result.event_1.HasValue && ((result.event_1.Value & (long)enAdditionalEventTypes.Falsestart) != 0)) ||
                                                          (result.event_2.HasValue && ((result.event_2.Value & (long)enAdditionalEventTypes.Falsestart) != 0)))
                                                         select member).ToList();

                HasFalsestart = MembersWithFalsestarts.Exists(arg => arg.id_member == MemberInfo.IDMember);

                if (Results != null)
                {
                    Results.ResultsForShow.RefreshFields(Results);
                }
            }
        }
예제 #12
0
        public int Compare(object x, object y)
        {
            if (GlobalDefines.ObjectBaseEquals(x, y) == enObjectBaseEqualsResult.True ||
                !((x is CMemberAndResults) && (y is CMemberAndResults)))
            {
                return(0);
            }

            return(Compare(x as CMemberAndResults, y as CMemberAndResults));
        }
예제 #13
0
 public CResult()
 {
     RemoveFalsestart = new CCommand(RemoveFalsestart_Executed,
                                     () =>
     {
         return(AdditionalEventTypes.HasValue &&
                AdditionalEventTypes.Value.HasFlag(enAdditionalEventTypes.Falsestart) &&
                ResultInDB?.participations?.groups != null &&
                !GlobalDefines.IsRoundFinished(ResultInDB.participations.groups.round_finished_flags, (enRounds)ResultInDB.round));
     }
                                     );
 }
        private void CPublishingResultsLogWnd_Loaded(object sender, RoutedEventArgs e)
        {
            Measure(GlobalDefines.STD_SIZE_FOR_MEASURE);
            MinWidth  = DesiredSize.Width;
            MinHeight = DesiredSize.Height;

            tctrlComps.Width  = tctrlComps.MinWidth = GlobalDefines.GetActualControlWidth(grdItems);
            tctrlComps.Height = tctrlComps.MinHeight = GlobalDefines.GetActualControlHeight(grdItems);

            tctrlComps.MaxHeight = tctrlComps.MaxWidth = double.PositiveInfinity;

            m_IsLoaded = true;
        }
예제 #15
0
        public static bool operator ==(CResult lhs, TimeSpan?rhs)
        {
            switch (GlobalDefines.ObjectBaseEquals(lhs, rhs))
            {
            case enObjectBaseEqualsResult.True:
                return(true);

            case enObjectBaseEqualsResult.False:
                return(false);

            default:
                return(rhs.TimeSpanEqualsForDB(lhs.Time));
            }
        }
예제 #16
0
        private void InitControls()
        {
            chkAutoscrollEnabled.IsChecked             = m_mainWnd.rchkAutoscrollEnabled.IsChecked;
            m_mainWnd.rchkAutoscrollEnabled.Checked   += m_mainWnd_rchkAutoscrollEnabled_CheckedOrUnchecked;
            m_mainWnd.rchkAutoscrollEnabled.Unchecked += m_mainWnd_rchkAutoscrollEnabled_CheckedOrUnchecked;

            chkShowGroupHead.IsChecked             = m_mainWnd.rchkShowGroupHead.IsChecked;
            m_mainWnd.rchkShowGroupHead.Checked   += m_mainWnd_rchkShowGroupHead_CheckedOrUnchecked;
            m_mainWnd.rchkShowGroupHead.Unchecked += m_mainWnd_rchkShowGroupHead_CheckedOrUnchecked;

            chkShowRibbon.IsChecked = !m_mainWnd.Ribbon.IsMinimized;
            (m_mainWnd.Ribbon.ContextMenu.Items[0] as RibbonMenuItem).Click += m_mainWnd_Ribbon_ContextMenu_Items_0_Click;

            chkAutoPublishing.IsChecked             = m_mainWnd.rchkAutoPublishing.IsChecked;
            m_mainWnd.rchkAutoPublishing.Checked   += m_mainWnd_rchkAutoPublishing_CheckedOrUnchecked;
            m_mainWnd.rchkAutoPublishing.Unchecked += m_mainWnd_rchkAutoPublishing_CheckedOrUnchecked;

            RefreshGroups();
            m_mainWnd.CurrentGroups.PropertyChanged   += m_mainWnd_CurrentGroups_PropertyChanged;
            m_mainWnd.CurrentGroups.CollectionChanged += m_mainWnd_CurrentGroups_CollectionChanged;

            RefreshRounds();
            m_mainWnd.CurrentRounds.PropertyChanged   += m_mainWnd_CurrentRounds_PropertyChanged;
            m_mainWnd.CurrentRounds.CollectionChanged += m_mainWnd_CurrentRounds_CollectionChanged;

            cmbHighlightTypes.ItemsSource   = m_mainWnd.HighlightTypes;
            cmbHighlightTypes.SelectedValue = m_mainWnd.CurHighlightGradesType;
            GlobalDefines.TuneComboboxWidth5(cmbHighlightTypes);

            OnPropertyChanged(MainWindow.ScannerStoppedPropertyName);
            OnPropertyChanged(MainWindow.RefreshEnabledPropertyName);
            OnPropertyChanged(MainWindow.SyncDBWithFilesEnabledPropertyName);
            OnPropertyChanged(MainWindow.DBToGridEnabledPropertyName);

            OnPropertyChanged(GroupSelectionEnabledPropertyName);
            OnPropertyChanged(RoundSelectionEnabledPropertyName);

            OnPropertyChanged(MainWindow.PublishEnabledPropertyName);

            OnPropertyChanged(MainWindow.SettingsEnabledPropertyName);
            OnPropertyChanged(MainWindow.LogWindowEnabledPropertyName);
            OnPropertyChanged(MainWindow.FalsestartRulesEnabledPropertyName);
            OnPropertyChanged(MainWindow.GodsModePropertyName);

            OnPropertyChanged(MainWindow.CalcGradesEnabledPropertyName);

            OnPropertyChanged(MainWindow.ExportToXlsEnabledPropertyName);

            SetTopMost();
        }
예제 #17
0
        public CMessageBoxEx(string messageBoxText,
                             string[] AdditionalButonsTexts = null,
                             int DefaultAdditionalButton    = -1,
                             bool DisableCloseButton        = false)
        {
            InitializeComponent();

            Result = MessageBoxResult.None;
            AdditionalButtonNum  = -1;
            m_DisableCloseButton = DisableCloseButton;
            Title           = AppAttributes.Title;
            txtblkText.Text = messageBoxText;

            img.Source = GlobalDefines.GetMsgBoxSystemIcon(MessageBoxImage.Information);
            AddStdButtons(MessageBoxButton.OK, MessageBoxResult.None);
            AddAdditionalButons(AdditionalButonsTexts, DefaultAdditionalButton);
        }
            private void Groups_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
            {
                switch (e.Action)
                {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
                case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
                    if (e.NewItems != null)
                    {
                        Groups.CollectionChanged -= Groups_CollectionChanged;

                        foreach (CGroupItem item in e.NewItems)
                        {
                            item.ClearCommaand = new CCommand(() =>
                            {
                                if (MessageBox.Show(Properties.Resources.resDeleteLogQuestion,
                                                    Properties.Resources.resDeletion,
                                                    MessageBoxButton.YesNo,
                                                    MessageBoxImage.Question,
                                                    MessageBoxResult.No) == MessageBoxResult.Yes)
                                {
                                    GlobalDefines.CheckPublishingDirExists();

                                    File.Delete(string.Format("{0}{1}\\{2}{3}",
                                                              GlobalDefines.STD_PUBLISHING_LOG_DIR,
                                                              id,
                                                              item.id,
                                                              GlobalDefines.PUBLISHING_LOG_FILE_EXTENSION));
                                    Groups.Remove(item);

                                    if (Groups.Count == 0)
                                    {
                                        Directory.Delete(string.Format("{0}{1}",
                                                                       GlobalDefines.STD_PUBLISHING_LOG_DIR,
                                                                       id));
                                        RaiseDeleteMe();
                                    }
                                }
                            });
                        }

                        Groups.CollectionChanged += Groups_CollectionChanged;
                    }
                    break;
                }
            }
예제 #19
0
        /// <summary>
        /// Сравнение TimeSpan с учётом того, что в БД хранятся не миллисекунды а сотые доли секунды
        /// </summary>
        /// <param name="DBTime">
        /// Время из БД, где сотые
        /// </param>
        /// <param name="StdTime">
        /// Стандартное время, где миллисекунды
        /// </param>
        /// <returns></returns>
        public static bool TimeSpanEqualsForDB(this TimeSpan?DBTime, TimeSpan?StdTime)
        {
            switch (GlobalDefines.ObjectBaseEquals(DBTime, StdTime))
            {
            case enObjectBaseEqualsResult.True:
                return(true);

            case enObjectBaseEqualsResult.False:
                return(false);

            default:
                return(DBTime.Value.Hours == StdTime.Value.Hours &&
                       DBTime.Value.Minutes == StdTime.Value.Minutes &&
                       DBTime.Value.Seconds == StdTime.Value.Seconds &&
                       DBTime.Value.Milliseconds / 10.0 == StdTime.Value.Milliseconds);
            }
        }
예제 #20
0
        private void btnSetGrades_Click(object sender, RoutedEventArgs e)
        {
            btnCalcPlaces_Click(sender, e);

            if (GlobalDefines.IsRoundFinished(DBManagerApp.m_Entities.groups.First(arg => arg.id_group == m_GroupId).round_finished_flags, enRounds.Final))
            {   // Можно расставить разряды, т.к. соревы закончились
                List <participations> Members = (from member in DBManagerApp.m_Entities.members
                                                 join part in DBManagerApp.m_Entities.participations on member.id_member equals part.member
                                                 where part.Group == m_GroupId
                                                 orderby part.result_place
                                                 select part).ToList();
                if (chkOnly75PercentForCalcGrades.IsChecked.Value)
                {
                    Members = new List <participations>(Members.Take((int)Math.Floor(Members.Count * 0.75)));
                }
                byte PlaceInYear = 1;

                foreach (participations part in Members)
                {
                    part.result_grade = null;

                    if (part.result_place.HasValue && part.members.year_of_birth.HasValue && SelectedYears.Contains(part.members.year_of_birth.Value))
                    {   // Участник подходит по возрасту
                        for (int i = 0; i < m_MinPlaceForNewGrade.Count; i++)
                        {
                            if (PlaceInYear <= m_MinPlaceForNewGrade[i].Value)
                            {
                                part.result_grade = (byte)m_MinPlaceForNewGrade[i].Key;
                                break;
                            }
                        }

                        PlaceInYear++;
                    }
                }

                DBManagerApp.m_Entities.SaveChanges();

                GradesChangedFromOpen = true;
            }
            else
            {
                MessageBox.Show(this, Properties.Resources.resCantSetGrades, Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="PartInDB"></param>
        /// <returns></returns>
        public void CopyPartToDB(participations PartInDB, enSecondColNameType SecondColNameType)
        {
            PartInDB.init_grade = GradeInEnum == enGrade.None ? null : (byte?)GradeInEnum;

            switch (SecondColNameType)
            {
            case enSecondColNameType.Coach:
                PartInDB.team  = null;
                PartInDB.coach = GlobalDefines.GetCoachId(SecondCol, true);
                break;

            case enSecondColNameType.Team:
            default:            // по умолчанию будет "команда"
                PartInDB.coach = null;
                PartInDB.team  = GlobalDefines.GetTeamId(SecondCol, true);
                break;
            }
        }
        };                                                                             // инициализацию m_PathWatcher нужно делать именно здесь, а не в конструкторе, т.к метод Start вызывется раньше создания класса


        public CPublishingResultsLogWnd()
        {
            InitializeComponent();

            GlobalDefines.CheckPublishingDirExists();

            txtLogFilePath.Text = GlobalDefines.STD_PUBLISHING_LOG_DIR;

            m_LogFileWatcher.Changed += m_LogFileWatcher_Changed;

            m_LogFileWatcher.BeginInit();
            m_LogFileWatcher.Path = GlobalDefines.STD_PUBLISHING_LOG_DIR;
            m_LogFileWatcher.EnableRaisingEvents = true; // Эту операцию нужно делать после запуска всех сканеров файлов
            m_LogFileWatcher.EndInit();

            Comps.CollectionChanged += Comps_CollectionChanged;

            RefreshItems();
        }
예제 #23
0
        public void updateBoard()
        {
            for (int cellRow = 0; cellRow < m_GameManager.BoardSize; cellRow++)
            {
                for (int cellColumn = 0; cellColumn < m_GameManager.BoardSize; cellColumn++)
                {
                    Cell boardCell = m_GameManager.Board[cellRow, cellColumn];

                    if (!boardCell.IsCellEmpty())
                    {
                        Soldier soldier = boardCell.Soldier;
                        m_ButtonsBoard[cellRow, cellColumn].Text = GlobalDefines.GetSoldierSign(soldier.Owner, soldier.SoldierType).ToString();
                    }
                    else
                    {
                        m_ButtonsBoard[cellRow, cellColumn].Text = string.Empty;
                    }
                }
            }
        }
예제 #24
0
        private void CLogWnd_Loaded(object sender, RoutedEventArgs e)
        {
            Measure(GlobalDefines.STD_SIZE_FOR_MEASURE);
            MinWidth  = DesiredSize.Width;
            MinHeight = DesiredSize.Height;

            lstvItems.Width  = lstvItems.MinWidth = GlobalDefines.GetActualControlWidth(grdItems);
            lstvItems.Height = lstvItems.MinHeight = GlobalDefines.GetActualControlHeight(grdItems);

            lstvItems.MaxHeight = lstvItems.MaxWidth = double.PositiveInfinity;

            (txtblkExceptionsHeader.Parent as Control).HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;

            if (m_Items.Count > 0)
            {
                LastHeaderClicked.Column.HeaderTemplate = DBManagerApp.m_AppSettings.m_Settings.m_GlobalResources["ListViewHeaderTemplateAsc"] as DataTemplate;
            }

            m_IsLoaded = true;
        }
예제 #25
0
        public CMessageBoxEx(string messageBoxText,
                             string caption,
                             MessageBoxButton button,
                             MessageBoxImage icon,
                             MessageBoxResult defaultResult,
                             string[] AdditionalButonsTexts = null,
                             int DefaultAdditionalButton    = -1,
                             bool DisableCloseButton        = false)
        {
            InitializeComponent();

            Result = MessageBoxResult.None;
            AdditionalButtonNum  = -1;
            m_DisableCloseButton = DisableCloseButton;
            Title           = caption;
            txtblkText.Text = messageBoxText;

            img.Source      = GlobalDefines.GetMsgBoxSystemIcon(icon);
            AddedStdButtons = AddStdButtons(button, defaultResult);
            AddAdditionalButons(AdditionalButonsTexts, DefaultAdditionalButton);
        }
예제 #26
0
        public static bool operator ==(CFullMemberInfo lhs, CMember rhs)
        {
            switch (GlobalDefines.ObjectBaseEquals(lhs, rhs))
            {
            case enObjectBaseEqualsResult.True:
                return(true);

            case enObjectBaseEqualsResult.False:
                return(false);

            default:
            {
                bool result = lhs.Name == rhs.Name &&
                              lhs.Surname == rhs.Surname &&
                              lhs.YearOfBirth == (rhs.YearOfBirthInShort < 0 ? (short)0 : rhs.YearOfBirthInShort);

                if (result)
                {
                    result = ((lhs.InitGrade == null && rhs.GradeInEnum == enGrade.None) || (lhs.InitGrade.Value == (byte)rhs.GradeInEnum));
                }

                if (result)
                {
                    // Т.к. тип второй колонки здесь поменяться не может, то делаем так
                    if (lhs.Coach == null)
                    {
                        result = ((lhs.Team == null && string.IsNullOrEmpty(rhs.SecondCol)) ||
                                  (lhs.Team == GlobalDefines.GetTeamId(rhs.SecondCol, false)));
                    }
                    else
                    {
                        result = ((lhs.Coach == null && string.IsNullOrEmpty(rhs.SecondCol)) ||
                                  (lhs.Coach == GlobalDefines.GetCoachId(rhs.SecondCol, false)));
                    }
                }

                return(result);
            }
            }
        }
예제 #27
0
        private CellButton createButtonByCell(int rowIndex, int colIndex, Cell boardCell)
        {
            CellButton boardButton = new CellButton(rowIndex, colIndex);

            boardButton.Size      = new Size(k_ButtonSize, k_ButtonSize);
            boardButton.BackColor = k_EnabledButtonColor;
            boardButton.Location  = new Point(k_BoardStartPoint.X + (colIndex * k_ButtonSize), k_BoardStartPoint.Y + (rowIndex * k_ButtonSize));
            boardButton.Click    += BoardButton_Click;
            boardButton.Enabled   = boardCell.IsEnabled;
            if (!boardButton.Enabled)
            {
                boardButton.BackColor = k_DisabledButtonColor;
            }

            if (!boardCell.IsCellEmpty())
            {
                Soldier soldier = boardCell.Soldier;
                boardButton.Text = GlobalDefines.GetSoldierSign(soldier.Owner, soldier.SoldierType).ToString();
            }

            return(boardButton);
        }
예제 #28
0
 public CoreTargetRules()
 {
     if (!BuildVulkan)
     {
         ModuleExcludeList.Add("VulkanRHI");
     }
     if (!BuildCSharp)
     {
         ModuleExcludeList.Add("CSharpContainer");
         ModuleExcludeList.Add("CSharpCore");
         ModuleExcludeList.Add("CSharpBridge");
         ModuleExcludeList.Add("CSTestGame");
         GlobalDefines.Add("NOCSHARP");
     }
     if (BuildPhysx)
     {
         GlobalDefines.Add("USE_PHYSX");
         ModuleExcludeList.Add("TDPhysics");
     }
     WindowTenVersionTarget = "1903";
     // WindowTenVersionTarget = "1803";
 }
예제 #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="FilePath">
        /// Если GlobalDefines.DEFAULT_XML_STRING_VAL, то используется значение из свойства FullFilePath
        /// </param>
        /// <returns></returns>
        public bool Read(string FilePath = GlobalDefines.DEFAULT_XML_STRING_VAL)
        {
            lock (DataSyncObj)
            {
                if (FilePath != GlobalDefines.DEFAULT_XML_STRING_VAL)
                {
                    FullFilePath = FilePath;
                }
                ClearData();
                if (FullFilePath != GlobalDefines.DEFAULT_XML_STRING_VAL && File.Exists(FullFilePath))
                {
                    // Проверяем, чтобы к файлу был доступ
                    if (!GlobalDefines.CheckFileAccessForXMLReading(FullFilePath))
                    {
                        return(false);
                    }

                    /* Нужно открывать файл для чтения именно так, если использовать StreamReader(FullFilePath), то процесс может не получить доступ к файлу,
                     * почему это так, написано здесь:
                     * http://stackoverflow.com/questions/1606349/does-a-streamreader-lock-a-text-file-whilst-it-is-in-use-can-i-prevent-this/1606370#1606370 */
                    using (FileStream fs = new FileStream(FullFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                        using (StreamReader reader = new StreamReader(fs))
                        {
                            try
                            {
                                XmlSerializer ser = new XmlSerializer(typeof(CAllExcelData));
                                Data = ser.Deserialize(reader) as CAllExcelData;
                            }
                            catch (Exception ex)
                            {
                                ex.ToString();
                            }
                        }
                }
            }

            return(Data != null);
        }
예제 #30
0
파일: UIManager.cs 프로젝트: avithalker/rep
        private static void printCell(Cell i_Cell, bool i_IsLastInRow)
        {
            char k_CellDelimiter = '|';
            char cellContent;

            if (i_Cell.IsCellEmpty())
            {
                cellContent = ' ';
            }
            else
            {
                cellContent = GlobalDefines.GetSoldierSign(i_Cell.Soldier.Owner, i_Cell.Soldier.SoldierType);
            }

            if (!i_IsLastInRow)
            {
                Console.Write("{0} {1} ", k_CellDelimiter, cellContent);
            }
            else
            {
                Console.Write("{0} {1} {0}", k_CellDelimiter, cellContent);
            }
        }