Example #1
0
        public ImportSIStorageViewModel(StorageContextViewModel storageContextViewModel)
        {
            _storageContextViewModel = storageContextViewModel;

            Storage.Error += OnError;
            Storage.Open();
        }
Example #2
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();
        }
 public ImportDBStorageViewModel(StorageContextViewModel storageContextViewModel)
 {
     _storageContextViewModel = storageContextViewModel;
 }
Example #4
0
        public ImportTextViewModel(object arg, StorageContextViewModel storageContextViewModel)
        {
            _arg = arg;
            _storageContextViewModel = storageContextViewModel;
            _scheduler = TaskScheduler.FromCurrentSynchronizationContext();

            #region Aliases
            Templates = new ObservableCollection <SpardTemplateViewModel>();

            var trashAlias = new EditAlias("Мусор", Colors.LightGray);

            _packageTemplate = new SpardTemplateViewModel {
                Name = "Пакет"
            };
            _packageTemplate.Aliases["PName"] = new EditAlias("Пакет", Colors.Orchid);
            _packageTemplate.Aliases["Some"]  = trashAlias;
            Templates.Add(_packageTemplate);

            _roundTemplate = new SpardTemplateViewModel {
                Name = "Раунд"
            };
            _roundTemplate.Aliases["RName"] = new EditAlias("Раунд", Colors.Olive);
            _roundTemplate.Aliases["Some"]  = trashAlias;
            Templates.Add(_roundTemplate);

            _themeTemplate = new SpardTemplateViewModel {
                Name = "Тема"
            };
            _themeTemplate.Aliases["TName"]    = new EditAlias("Тема", Colors.BlueViolet);
            _themeTemplate.Aliases["TAuthor"]  = new EditAlias("Автор", Colors.Maroon);
            _themeTemplate.Aliases["TComment"] = new EditAlias("Комментарий", Colors.Navy);
            _themeTemplate.Aliases["Some"]     = trashAlias;
            Templates.Add(_themeTemplate);

            _questTemplate = new SpardTemplateViewModel {
                Name = "Вопрос"
            };
            _questTemplate.Aliases["Number"]   = new EditAlias("Номер", Colors.SkyBlue);
            _questTemplate.Aliases["QText"]    = new EditAlias("Вопрос", Colors.SeaGreen);
            _questTemplate.Aliases["Answer"]   = new EditAlias("Ответ", Colors.Yellow);
            _questTemplate.Aliases["QAuthor"]  = new EditAlias("Автор", Colors.Goldenrod);
            _questTemplate.Aliases["QComment"] = new EditAlias("Комментарий", Colors.Cyan);
            _questTemplate.Aliases["QSource"]  = new EditAlias("Источник", Colors.Chocolate);
            _questTemplate.Aliases["Some"]     = trashAlias;
            Templates.Add(_questTemplate);

            _separatorTemplate = new SpardTemplateViewModel {
                Name = "Разделитель", NonStandartOnly = true
            };
            _separatorTemplate.Aliases["Some"] = trashAlias;

            _answerTemplate = new SpardTemplateViewModel {
                Name = "Ответ", NonStandartOnly = true
            };

            foreach (var item in _questTemplate.Aliases)
            {
                _answerTemplate.Aliases[item.Key] = item.Value;
            }

            foreach (var item in Templates)
            {
                item.PropertyChanged += Item_PropertyChanged;
                foreach (var alias in item.Aliases)
                {
                    if (!Aliases.ContainsKey(alias.Key))
                    {
                        Aliases[alias.Key] = alias.Value;
                    }
                }
            }

            #endregion

            _sns = new SimpleCommand(Sns_Executed)
            {
                CanBeExecuted = false
            };
            _auto = new SimpleCommand(Auto_Executed)
            {
                CanBeExecuted = false
            };
            _go   = new SimpleCommand(Go_Executed);
            _skip = new SimpleCommand(Skip_Executed);
        }
Example #5
0
        public NewViewModel(StorageContextViewModel storageContextViewModel)
        {
            _storageContextViewModel = storageContextViewModel;

            Create = new SimpleCommand(Create_Executed);
        }