コード例 #1
0
ファイル: CarboGroup.cs プロジェクト: DavidVeld/CarboLifeCalc
 internal void TrucateElements()
 {
     if (AllElements.Count > 0)
     {
         this.Description += " Removed: " + this.AllElements[0].Name;
         AllElements.Clear();
     }
 }
コード例 #2
0
        private void Filter()
        {
            AllElements.Clear();
            DBRepository <Elements> dBRepository = new DBRepository <Elements>(new BuildEntities());

            foreach (var item in dBRepository.GetAll().Where(s => s.Type.ToUpper().Contains(Find.ToUpper()) || s.Title.ToUpper().Contains(Find.ToUpper())))
            {
                AllElements.Add(item);
            }
            dBRepository.Dispose();
        }
コード例 #3
0
 public virtual void InitElements()
 {
     RootElements.Clear();
     AllElements.Clear();
     foreach (var cell in Current.ForEach())
     {
         Init(cell);
     }
     if (MouseMoveElement != null)
     {
         AddAndInitElement(MouseMoveElement);
     }
     if (Text != null)
     {
         AddAndInitElement(Text);
     }
 }
コード例 #4
0
ファイル: MainVM.cs プロジェクト: vildar82/ShortcutMonitor
        private async void UpdateExecute()
        {
            try
            {
                projectWatcher?.Watcher?.Dispose();
                if (inUpdate || !Directory.Exists(ShortcutFolder))
                {
                    return;
                }

//                projectWatcher = new FileWatcherRx(ShortcutFolder, "", (NotifyFilters) 19, WatcherChangeTypes.All);
//                projectWatcher.Watcher.IncludeSubdirectories = true;
//                projectWatcher.Created.ObserveOn(dispatcher).Subscribe(s => OnCreatedProject(s.EventArgs));
//                projectWatcher.Deleted.ObserveOn(dispatcher).Subscribe(s => OnDeletedProject(s.EventArgs));
//                projectWatcher.Renamed.ObserveOn(dispatcher).Subscribe(s => OnRenamedProject(s.EventArgs));
//                projectWatcher.Changed.ObserveOn(dispatcher).Subscribe(s => OnChangedProject(s.EventArgs));
                inUpdate = true;
                var files = new List <FileInfo>();
                AllElements.Clear();
                AllProjects.Clear();
                await ShowProgressDialog(c =>
                {
                    c.SetIndeterminate();
                    if (ShortcutFolder == null || !Directory.Exists(ShortcutFolder))
                    {
                        return;
                    }

                    files = GetShortcutFiles(ShortcutFolder).Result;
                }, "Загрузка элементов...", "", false);

                if (!files.Any())
                {
                    ShowMessage("Не найдены файлы быстрых ссылок (xml)");
                    return;
                }

                foreach (var xmls in files.ChunkBy(50))
                {
                    var items = await GetShortcutItems(xmls);

                    foreach (var i in items)
                    {
                        Checks.CheckElement(i);
                        i.Project.Shortcuts.Add(i);
                        AllElements.Add(i);
                    }
                }

                var projects = Project.GetProjects();
                AllProjects.AddRange(projects);
                ProjectsVM.UpdateProjects();
            }
            catch (Exception ex)
            {
                ShowMessage(ex.ToString());
            }
            finally
            {
                inUpdate = false;
            }
        }