예제 #1
0
 private void Manager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(KunosCareerManager.Current))
     {
         MainList.MoveCurrentTo(Manager.Current);
     }
 }
예제 #2
0
        // Adds the Fiber to the start of the given list
        private void AddFirst(Fiber inFiber, ref MainList ioList)
        {
            int fiberIndex = (int)inFiber.Index;

            // If there are no free fibers currently,
            // we can just add this as the first and only entry.
            if (ioList.Head == -1)
            {
                ioList.Head = fiberIndex;
                m_Entries[fiberIndex].MainNext = -1;
                m_Entries[fiberIndex].MainPrev = fiberIndex;
            }
            else
            {
                Entry firstEntry = m_Entries[ioList.Head];

                // Point back at the current last entry
                m_Entries[fiberIndex].MainPrev = firstEntry.MainPrev;

                // Point at the old first free entry
                m_Entries[fiberIndex].MainNext = ioList.Head;

                // Point the old first entry at the new first entry
                m_Entries[ioList.Head].MainPrev = fiberIndex;

                ioList.Head = fiberIndex;
            }

            ++ioList.Count;
        }
 internal void Start()
 {
     if (ViewModel.CurrentList.HasItems == false)
     {
         MainList.LoadItemsAsync();
     }
 }
예제 #4
0
        public void InitList()
        {
            var tempSchoolYearList = new List <string>();

            tempSchoolYearList.Add("历年成绩");

            var tempTermList = new List <string>();

            tempTermList.Add("全部学期");

            foreach (var item in this)
            {
                MainList.Add(item);//向主表添加成绩

                if (!tempSchoolYearList.Contains(item.SchoolYear))
                {
                    tempSchoolYearList.Add(item.SchoolYear);
                }
                //过滤出所有的学年和学期
                if (!tempTermList.Contains(item.Term))
                {
                    tempTermList.Add(item.Term);
                }
            }

            SchoolYearList = tempSchoolYearList;

            TermList = tempTermList;
        }
예제 #5
0
 protected virtual void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     while (MainList.Count > 0)
     {
         IWork work = MainList.First.Value;
         if (!work.Initialize())
         {
             work.OnFailed();
             RunOnFailed();
             return;
         }
         if (!work.Execute())
         {
             work.OnFailed();
             RunOnFailed();
             return;
         }
         work.OnCompleted();
         MainList.RemoveFirst();
     }
     if (MainList.Count == 0)
     {
         RunOnCompleted();
     }
 }
예제 #6
0
            private void CurrentChanged(bool save)
            {
                var item = (ServerEntry)MainList.CurrentItem;

                if (item == null)
                {
                    return;
                }

                if (save)
                {
                    LimitedStorage.Set(LimitedSpace.OnlineSelected, Key, item.Id);
                    _loadCurrentFailed = null;
                }

                if (ReferenceEquals(_current, item))
                {
                    return;
                }
                _current = item;
                _showDetails.Invoke(item);

                if (_testMeLater != null)
                {
                    var testMeLater = _testMeLater;
                    _testMeLater = null;
                    MainList.Refresh(testMeLater);
                }
            }
예제 #7
0
 protected AcListPageViewModel([NotNull] IAcManagerNew list, IFilter <T> listFilter) : base(list, listFilter, KeyBase, false)
 {
     Manager         = list;
     CopyIdsCommand  = new DelegateCommand(() => ClipboardHelper.SetText(MainList.OfType <AcItemWrapper>().Select(x => x.Id).JoinToString('\n')));
     CopyTagsCommand = new DelegateCommand(() => ClipboardHelper.SetText(MainList.OfType <AcItemWrapper>().Select(x => x.Value)
                                                                         .OfType <AcJsonObjectNew>().SelectMany(x => x.Tags).OrderBy(x => x).Distinct().JoinToString('\n')));
 }
예제 #8
0
        // Removes the first Fiber from the given list.
        private Fiber RemoveFirst(ref MainList ioList)
        {
            int fiberIndex = ioList.Head;

            if (fiberIndex == -1)
            {
                return(null);
            }

            int nextIndex = m_Entries[fiberIndex].MainNext;
            int prevIndex = m_Entries[fiberIndex].MainPrev;

            // If the table only has one entry,
            // just remove it and set the table to empty.
            if (nextIndex == -1)
            {
                m_Entries[fiberIndex].MainPrev = -1;
                ioList.Head = -1;
                --ioList.Count;
                return(m_Entries[fiberIndex].Fiber);
            }

            // Point the next entry at the last entry
            m_Entries[nextIndex].MainPrev = prevIndex;

            // Clear pointers in the current entry
            m_Entries[fiberIndex].MainNext = -1;
            m_Entries[fiberIndex].MainPrev = -1;

            // Point to the next entry as the first.
            ioList.Head = nextIndex;
            --ioList.Count;

            return(m_Entries[fiberIndex].Fiber);
        }
예제 #9
0
        private void AddRoom(long roomId, bool isSave = false)
        {
            var room = new Rooms(roomId);

            room.Refresh().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    MessageBox.Show(room.Message, @"错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                MainList.Invoke(new Action(() =>
                {
                    if (_table.All(x => x.RealRoomID != room.RealRoomID))
                    {
                        _table.Add(room);
                        Table.Add(room);

                        AddCheckRoomStatusTask(room);

                        if (isSave)
                        {
                            SaveConfig();
                        }

                        NewRoomId.Clear();
                    }
                    else
                    {
                        MessageBox.Show($@"已添加房间 {room.RealRoomID}", @"提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }));
            });
        }
예제 #10
0
        private void UpdateStatusTexts(object sender, NotifyCollectionChangedEventArgs e)
        {
            var replace = MainList.Count(x => x.NextStep == FileTask.Replace);
            var create  = MainList.Count(x => x.NextStep == FileTask.Create);
            var delete  = MainList.Count(x => x.NextStep == FileTask.Delete);
            var changes = create + replace + delete;

            StatusText = $"{MainList.Count().x("remote file")} found :  {changes.x("change")}";

            var ss = new List <string>();

            if (replace != 0)
            {
                ss.Add($"Replace {replace.x("file")}");
            }
            if (create != 0)
            {
                ss.Add($"Create { create.x("file")}");
            }
            if (delete != 0)
            {
                ss.Add($"Delete { delete.x("file")}");
            }

            ButtonText = (changes == 0) ? "No action needed"
                       : string.Join("; ", ss)
                         + " in Remote";
        }
예제 #11
0
 private void OnManagerPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(UserChampionshipsManager.Current))
     {
         MainList.MoveCurrentTo(Manager.Current);
     }
 }
예제 #12
0
        public void InitList()
        {
            if (SchoolYearList == null)
            {
                SchoolYearList = new ObservableCollection <string>();
            }
            if (TermList == null)
            {
                TermList = new ObservableCollection <string>();
            }
            foreach (var item in this)
            {
                MainList.Add(item);

                if (!SchoolYearList.Contains(item.SchoolYear))
                {
                    SchoolYearList.Add(item.SchoolYear);
                }
                //过滤出所有的学年和学期
                if (!TermList.Contains(item.Term))
                {
                    TermList.Add(item.Term);
                }
            }
        }
        private void CheckerItemClicked(object sender, ItemClickEventArgs e)
        {
            LastClickedItem = MainList.ContainerFromItem(e.ClickedItem) as GridViewItem;
            ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ID", LastClickedItem);

            (Window.Current.Content as Frame).Navigate(typeof(WebContentChangeNotifyItem), CurrentManager.UrlContentCheckerList.ElementAt((sender as GridView).Items.IndexOf(e.ClickedItem)));
        }
예제 #14
0
        internal void UpdateUI()// метод для обновления элементов пользовательского интерфейса
        {
            int selected = MainList.SelectedIndex;

            MainList.Items.Clear();
            // Вызов Singleton объекта Менеджера фигур
            EntityManager manager = EntityManager.GetInstance();

            for (int i = 0; i < manager.GetCount(); i++)
            {
                Figure figure = manager.Get(i);

                // Дифференциация объектов по типу..
                string element = ":    -";
                switch (figure)
                {
                case Circle _:
                    element = ":    +    3";
                    break;

                case Rhombus _:
                    element = ":    +    2";
                    break;

                case Triangle _:
                    element = ":    +    1";
                    break;
                }
                // Добавление строки в список
                MainList.Items.Add(i + element);
            }
            // Если ранее был выбран элемент, необходимо сохранить на нём фокус
            MainList.SetSelected((selected > 0) ? selected : 0, true);
        }
예제 #15
0
            public void Load()
            {
                Debug.Assert(!_loaded);
                _loaded = true;

                Manager.List.CollectionChanged   += List_CollectionChanged;
                Manager.List.ItemPropertyChanged += List_ItemPropertyChanged;

                using (MainList.DeferRefresh()) {
                    MainList.Filter     = FilterTest;
                    MainList.CustomSort = Sorting;
                }

                if (!Pack.LoadingComplete)
                {
                    // In case pack is basically ready, but there is still something loads in background,
                    // we need to use StartLoading() anyway — current loading process will be cancelled,
                    // if there is no “listeners”
                    StartLoading().Forget();
                }

                if (Pack.Status == OnlineManagerStatus.Ready)
                {
                    StartPinging().Forget();
                }

                LoadCurrent();
                MainList.CurrentChanged += OnCurrentChanged;

                Pack.Ready += Pack_Ready;
            }
예제 #16
0
        // Adds the Fiber to the end of the given list
        private void AddLast(Fiber inFiber, ref MainList ioList)
        {
            int fiberIndex = (int)inFiber.Index;

            // If there are no free fibers currently,
            // we can just add this as the first and only entry.
            if (ioList.Head == -1)
            {
                ioList.Head = fiberIndex;
                m_Entries[fiberIndex].MainNext = -1;
                m_Entries[fiberIndex].MainPrev = fiberIndex;
            }
            else
            {
                Entry firstEntry = m_Entries[ioList.Head];

                // Point the old last entry to this one
                m_Entries[firstEntry.MainPrev].MainNext = fiberIndex;

                // Point the new last entry at the previous one
                m_Entries[fiberIndex].MainPrev = firstEntry.MainPrev;

                // Point the new last entry at nothing
                m_Entries[fiberIndex].MainNext = -1;

                // Point the first entry at this one
                m_Entries[ioList.Head].MainPrev = fiberIndex;
            }

            ++ioList.Count;
        }
        private void SetupControls()
        {
            MainList = Resources["MainList"] as ToDoList;
            MainList.MessageService = new MessageService(this);
            MainList.BindingContext = ViewModel.CurrentList;

            AllLists = Resources["AllLists"] as ListManager;

            ViewModel.Sections.Add(MainList);
            ViewModel.Sections.Add(AllLists);

            ViewModel.NewItemCommand = new Command(() =>
            {
                var newItem = MainList.CreateNew();
                ShowCurrentView(MainList.Title, MainList);
            });

            ViewModel.ClearListCommand = new Command(() =>
            {
                ViewModel.CurrentList.Elements.Clear();
                ShowCurrentView(MainList.Title, MainList);
            });

            BindingContext = ViewModel;

            ShowCurrentView(MainList.Title, MainList);

            ManageTasksButton.Clicked += delegate { ShowCurrentView(MainList.Title, MainList); };
            ManageListButton.Clicked  += delegate { ShowCurrentView(AllLists.Title, AllLists); };
        }
예제 #18
0
        private void SearchMainList()
        {
            var index = 0;

            if (MainList.SelectedRows.Count == 1)
            {
                index = MainList.SelectedRows[0].Index;
            }

            for (var i = 0; i < MainList.RowCount + 1; ++i)
            {
                if (IsContainsString(index, Search_TextBox.Text))
                {
                    if (!MainList.Rows[index].Selected)
                    {
                        MainList.Rows[index].Selected = true;
                        MainList.CurrentCell          = MainList.Rows[index].Cells[0];
                        return;
                    }
                    MainList.ClearSelection();
                }

                if (index == MainList.RowCount - 1)
                {
                    index = 0;
                }
                else
                {
                    ++index;
                }
            }

            MainList.ClearSelection();
        }
예제 #19
0
        public void GetSpecificGradeChart(string schoolYear, string term)
        {
            //清空当前显示的成绩表
            MainList.Clear();

            foreach (var item in this)
            {
                if (schoolYear != null)
                {
                    if (schoolYear == "历年成绩")
                    {
                        MainList.Add(item);
                    }
                    else
                    {
                        if (item.SchoolYear == schoolYear)
                        {
                            MainList.Add(item);
                        }
                    }
                }
            }
            if (term != null && term != "-1")
            {
                for (int i = 0; i < MainList.Count; i++)
                {
                    if (MainList[i].Term != term)
                    {
                        MainList.RemoveAt(i);
                        i--;
                    }
                }
            }
        }
예제 #20
0
        // Removes an entry from the Fiber list.
        private void RemoveEntry(Fiber inFiber, ref MainList ioList)
        {
            int fiberIndex = (int)inFiber.Index;
            int nextIndex  = m_Entries[fiberIndex].MainNext;
            int prevIndex  = m_Entries[fiberIndex].MainPrev;

            // If the list is already empty, we can't do anything about it
            if (ioList.Head == -1)
            {
                return;
            }

            // Ensure the next entry is pointing back to our previous index.
            m_Entries[nextIndex == -1 ? ioList.Head : nextIndex].MainPrev = prevIndex;

            // If we're the first entry, the first entry is now our last
            if (fiberIndex == ioList.Head)
            {
                ioList.Head = nextIndex;
            }
            else
            {
                // Previous entry should point back to our next entry
                m_Entries[prevIndex].MainNext = nextIndex;
            }

            m_Entries[fiberIndex].MainNext = -1;
            m_Entries[fiberIndex].MainPrev = -1;

            --ioList.Count;
        }
예제 #21
0
        /// <summary>
        /// Notepad void
        /// </summary>
        /// <param name="_name">Name</param>
        /// <param name="_typePlayer">Type player</param>
        /// <param name="_stepFinishPlayer">MainSize and FinishStep</param>
        private static void NotepadPlayerMethod(string _name, string _typePlayer, int _stepFinishPlayer)
        {
            Thread        notepadPlayerThread = new Thread(new ParameterizedThreadStart(NotepadPlayerLogic.CalcNotepadPlayer));
            NotepadPlayer notepadpl1          = new NotepadPlayer(_name: _name, _stepFinish: _stepFinishPlayer);

            MainList.AddMainList(new MainList(_countPlayers: 1, _namePlayer: _name, _typePlayer: _typePlayer, _stepFinishPlayer: _stepFinishPlayer));
            notepadPlayerThread.Start(notepadpl1);
        }
예제 #22
0
        /// <summary>
        /// Chiter void
        /// </summary>
        /// <param name="_name">Name</param>
        /// <param name="_typePlayer">Type player</param>
        /// <param name="_stepFinishPlayer">MainSize and FinishStep</param>
        private static void ChiterPlayerMethod(string _name, string _typePlayer, int _stepFinishPlayer)
        {
            Thread       chiterPlayerThread = new Thread(new ParameterizedThreadStart(ChiterPlayerLogic.CalcChiterPlayer));
            ChiterPlayer chiterPlayer       = new ChiterPlayer(_name: _name, _stepFinish: MainSize);

            MainList.AddMainList(new MainList(_countPlayers: 1, _namePlayer: _name, _typePlayer: _typePlayer, _stepFinishPlayer: MainSize));
            chiterPlayerThread.Start(chiterPlayer);
        }
예제 #23
0
        /// <summary>
        /// Uber void
        /// </summary>
        /// <param name="_name">Name</param>
        /// <param name="_typePlayer">Type player</param>
        /// <param name="_stepFinishPlayer">MainSize and FinishStep</param>
        private static void UberPlayerPlayerMethod(string _name, string _typePlayer, int _stepFinishPlayer)
        {
            Thread     uberPlayerThread = new Thread(new ParameterizedThreadStart(UberPlayerLogic.CalcUberPlayer));
            UberPlayer uberpl1          = new UberPlayer(_name: "Den", _stepFinish: MainSize);

            MainList.AddMainList(new MainList(_countPlayers: 1, _namePlayer: "Den", _typePlayer: "UberPlayer", _stepFinishPlayer: 100));
            uberPlayerThread.Start(uberpl1);
        }
예제 #24
0
 public void Clear()
 {
     lock (Locker)
     {
         MainList.Clear();
         _filterList.Clear();
     }
 }
예제 #25
0
        /// <summary>
        /// Simple void
        /// </summary>
        /// <param name="_name">Name</param>
        /// <param name="_typePlayer">Type player</param>
        /// <param name="_stepFinishPlayer">MainSize and FinishStep</param>
        private static void SimplePlayerMethod(string _name, string _typePlayer, int _stepFinishPlayer)
        {
            Thread       simplePlayerThread = new Thread(new ParameterizedThreadStart(SimplePlayerLogic.CalcSimplePlayer));
            SimplePlayer simplepl1          = new SimplePlayer(_name: _name, _stepFinish: _stepFinishPlayer);

            MainList.AddMainList(new MainList(_countPlayers: 1, _namePlayer: _name, _typePlayer: _typePlayer, _stepFinishPlayer: _stepFinishPlayer));
            simplePlayerThread.Start(simplepl1);
        }
        internal void SwitchFloatingTools()
        {
            var createAction = this.FindByName <ToolbarItem>("CreateAction");

            if (createAction != null)
            {
                ToolbarItems.Remove(createAction);
            }
            MainList.EnableCreateFloatingButton(createAction.Command);
        }
예제 #27
0
        public ActionSelectorWindow(string Title, List <ActionSelectorItem> actions)
        {
            InitializeComponent();
            this.Title = Title;

            MainList.ItemsSource       = actions;
            MainList.DisplayMemberPath = nameof(ActionSelectorItem.Name);
            MainList.SelectedIndex     = 0;
            MainList.Focus();
        }
예제 #28
0
        private void MainList_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
        {
            var columnIndex = MainList.HitTest(_mainListMouseLocationX, _mainListMouseLocationY).ColumnIndex;

            if (e.Column.Index == columnIndex)
            {
                Debug.WriteLine($@"列宽改变:{columnIndex}");
                SaveConfig();
            }
        }
예제 #29
0
        public void GetGradeChart(string html)
        {
            try
            {
                MainList?.Clear();
                this?.Clear();//清空全部成绩信息


                int    start   = html.IndexOf("<table class=\"datelist\"");
                int    end     = html.IndexOf("</table>", start);
                char[] charScr = new char[end - start + 8];
                html.CopyTo(start, charScr, 0, end - start + 8);
                //NSoup.Nodes.Document doc = NSoup.NSoupClient.Parse(html);
                //NSoup.Nodes.Element element = doc.GetElementById("Datagrid1");
                //NSoup.Select.Elements trs = element.Select("tr");
                StringBuilder sb = new StringBuilder();
                sb.Append(charScr);

                var parser   = new HtmlParser();
                var document = parser.Parse(sb.ToString());

                var    emphasize = document.GetElementById("Datagrid1");
                var    trs = emphasize.QuerySelectorAll("tr");
                string score, rescore, relearn;
                for (int i = 1; i < trs.Length; i++)
                {
                    var tds = trs[i].QuerySelectorAll("td");
                    //学校空格为“&nbsp”;
                    //如果存在补考成绩或者重修成绩,就将成绩置为重修成绩
                    score   = tds[8].InnerHtml == "&nbsp;" ? "" : tds[8].InnerHtml;
                    rescore = tds[10].InnerHtml == "&nbsp;" ? "" : tds[10].InnerHtml;
                    relearn = tds[11].InnerHtml == "&nbsp;" ? "" : tds[11].InnerHtml;
                    if (rescore.Length > 0)
                    {
                        score = rescore;
                    }
                    if (relearn.Length > 0)
                    {
                        score = relearn;
                    }
                    AddRecord(tds[0].InnerHtml == "&nbsp;" ? "" : tds[0].InnerHtml,
                              tds[1].InnerHtml == "&nbsp;" ? "" : tds[1].InnerHtml,
                              tds[3].InnerHtml == "&nbsp;" ? "" : tds[3].InnerHtml,
                              tds[6].InnerHtml == "&nbsp;" ? "" : tds[6].InnerHtml,
                              score, rescore,
                              tds[9].InnerHtml == "&nbsp;" ? "" : tds[9].InnerHtml,
                              relearn, tds[5].InnerHtml == "&nbsp;" ? "" : tds[5].InnerHtml
                              );
                }
            }
            catch
            {
                throw;
            }
        }
예제 #30
0
 protected void MainList_NodeCheck(object sender, TreeCheckEventArgs e)
 {
     if (e.Checked)
     {
         MainList.CheckAllNodes(e.Node.Nodes);
     }
     else
     {
         MainList.UncheckAllNodes(e.Node.Nodes);
     }
 }