public MainViewModel(QuickMediaSorterProject qms) { _qms = qms; ImagesViewViewModel = new ImagesViewModel(qms); // get the list of actions var lst = new List <QuickMediaSorterProjectBatch>(qms.Batch); // create a list of view models UserActions = new ObservableCollection <ActionViewModel>(lst.Select(a => new ActionViewModel(a, qms.Path))); SaveCommand = new RelayCommand(Save); AddActionCommand = new RelayCommand(AddNewAction); PathBrowserViewModel = new PathBrowserViewModel(); PathBrowserViewModel.Path = _qms.Path; PathBrowserViewModel.OnPathChanged += (s, e) => { Refresh(); }; }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // if qms file // load it (it includes folder) // else // load default qms // if not folder // open dialog for folder // QuickMediaSorterProject qms = null; if ((args != null) && (args.Any())) { string path = args[0]; if (PathHelper.IsFolder(path)) { // We have only path // - Read or generate default project qms = QmsFactory.GetDefault(); // - Set its path qms.Folder = path; } else { // We have a qms file - try to read it try { qms = QmsFactory.Load(path); } catch (Exception ex) { ErrorHandler.Handle(ex, "Couldn't load file", true); } } } else { // No arguments - read or generate default project qms = QmsFactory.GetDefault(); } if (qms != null && qms.Folder == null) { // Our project has no folder - open browse window to the user String f = qms.Folder; if (DialogHelper.BrowseOpenFolderDialog(ref f)) { qms.Folder = f; } } qms.InitializeActions(); MainWindow view = new MainWindow(qms); view.ReadFiles(); Application.Run(view); }
public ImagesViewModel(QuickMediaSorterProject qms) { qms.OnChange += (s, e) => { Refresh(); }; Refresh(); }
public MainWindow(QuickMediaSorterProject projectClass) { InitializeComponent(); Qms = projectClass; }