예제 #1
0
        /// <summary>
        ///
        /// Adds a round to the history, bumping the oldest round off the end of the
        /// history, if adding the new round would make the list longer than the maximum
        ///
        /// </summary>
        /// <param name="newRound"></param>

        public void Push(Round newRound)
        {
            if (Rounds.Count == maxLength)
            {
                Rounds.RemoveAt(maxLength - 1);
            }

            Rounds.Insert(0, newRound);
        }
예제 #2
0
        public FalsestartRules(ObservableDictionary <long, CKeyValuePairEx <long, CCompSettings> > currentGroups)
        {
            InitializeComponent();

            Rounds = GlobalDefines.ROUND_NAMES.ToList();
            Rounds.RemoveAt(Rounds.Count - 1); // Удаляем итоговый протокол

            Title = Properties.Resources.resFalsestartRulesWndTitle;

            HasUnsavedChanges += () => { return(Modified); };

            // Заполняем список уже имеющимися группами
            foreach (var groupDesc in currentGroups)
            {
                Groups.Add(new KeyValuePair <long, string>(groupDesc.Key, groupDesc.Value.Value.AgeGroup.FullGroupName));
            }
            cmbGroups.SelectedIndex = 0;
            ShowRules((KeyValuePair <long, string>?)cmbGroups.SelectedItem);


            CommandBinding cmdb = new CommandBinding()
            {
                Command = cmdAdd
            };

            cmdb.Executed   += AddCmdExecuted;
            cmdb.CanExecute += AddCmdCanExecute;
            CommandBindings.Add(cmdb);

            cmdb = new CommandBinding()
            {
                Command = cmdDel
            };
            cmdb.Executed   += DelCmdExecuted;
            cmdb.CanExecute += DelCmdCanExecute;
            CommandBindings.Add(cmdb);


            InputBinding inpb = new InputBinding(cmdAdd, new KeyGesture(Key.Insert));

            InputBindings.Add(inpb);
            inpb = new InputBinding(cmdDel, new KeyGesture(Key.Delete));
            InputBindings.Add(inpb);


            ModifiedFromOpen = Modified = false;
        }