Example #1
0
        public MainViewModel(string[] args)
        {
            DocList = new ObservableCollection <WorkspaceViewModel>();
            DocList.CollectionChanged += DocList_CollectionChanged;
            CollectionViewSource.GetDefaultView(DocList).CurrentChanged += MainViewModel_CurrentChanged;

            Open       = new SimpleCommand(Open_Executed);
            OpenRecent = new SimpleCommand(OpenRecent_Executed);

            ImportTxt          = new SimpleCommand(ImportTxt_Executed);
            ImportClipboardTxt = new SimpleCommand(ImportClipboardTxt_Executed);
            ImportXml          = new SimpleCommand(ImportXml_Executed);
            ImportBase         = new SimpleCommand(ImportBase_Executed);
            ImportFromSIStore  = new SimpleCommand(ImportFromSIStore_Executed);

            SaveAll = new SimpleCommand(SaveAll_Executed)
            {
                CanBeExecuted = false
            };

            About    = new SimpleCommand(About_Executed);
            Feedback = new SimpleCommand(Feedback_Executed);
            Donate   = new SimpleCommand(Donate_Executed);

            SetSettings  = new SimpleCommand(SetSettings_Executed);
            SearchFolder = new SimpleCommand(SearchFolder_Executed);

            _storageContextViewModel = new StorageContextViewModel(new Services.SI.SIStorageService());
            _storageContextViewModel.Load();

            AddCommandBinding(ApplicationCommands.New, New_Executed);
            AddCommandBinding(ApplicationCommands.Open, (sender, e) => Open_Executed(e.Parameter));
            AddCommandBinding(ApplicationCommands.Help, Help_Executed);
            AddCommandBinding(ApplicationCommands.Close, Close_Executed);

            _args = args;

            UI.Initialize();
        }