public ElementsVM(MainVM mainVm) : base(mainVm) { filterObs = this.WhenAnyValue(v => v.Filter); OpenProjectFolder = CreateCommand <ShortcutItem>(OpenProjectFolderExec); OpenSourceDwg = CreateCommand <ShortcutItem>(OpenSourceDwgExec); OpenAutor = CreateCommand <string>(OpenAutorExec); MainVM.AllElements.Connect().AutoRefreshOnObservable(f => filterObs) .Filter(OnFilter) .Bind(out var data) .Subscribe(); Elements = data; Email = CreateCommand <ShortcutItem>(EmailExec); FixCmd = CreateCommand <ShortcutItem>(FixCmdExec); }
public ProjectsVM(MainVM mainVm) : base(mainVm) { MainVm = mainVm; filterObs = this.WhenAnyValue(v => v.Filter); OpenDir = CreateCommand <Project>(OpenDirExec); OpenSourceFolder = CreateCommand <ShortcutItem>(OpenSourceFolderExec); MainVM.AllProjects.Connect().AutoRefreshOnObservable(f => filterObs) .Filter(OnFilter) .Bind(out var data) .Subscribe(); Projects = data; SendEmail = CreateCommand <State>(SendEmailExec); FixCmd = CreateCommand <State>(FixExec); }
private async Task <List <Project> > CheckOtherProjects() { return(await Task.Run(async() => { var projects = new List <Project>(); var dir = new DirectoryInfo(MainVm.ShortcutFolder); foreach (var projDir in dir.EnumerateDirectories()) { if (Project.GetProject(projDir, false) == null) { var proj = Project.GetProject(projDir, true); var itemFiles = await MainVM.GetShortcutFiles(projDir.FullName); proj.Shortcuts = await MainVM.GetShortcutItems(itemFiles); foreach (var i in proj.Shortcuts) { Checks.CheckElement(i); } projects.Add(proj); } } return projects; })); }