public MainViewModel()
        {
            Timer = new SessionTimer();
            Timer.PropertyChanged += (sender, args) => { OnPropertyChanged("Uptime"); };

            Settings = new SettingsManager();

            Model = new MainModel();
            Model.PropertyChanged += (o, args) => { UpdateUI(); };

            //установка стратегии
            Model.SetPrinter(new RawPrinter(80, ".txt"));

            //инициализация комманд
            LogoffCommand = new RelayCommand(Logoff);
            LockCommand = new RelayCommand(Lock);
            SettingsCommand = new RelayCommand(ShowSettings);
            LoggerCommand = new RelayCommand(ShowLog);
            SearchCommand = new RelayCommand(ShowSearch);
            ManuallyAddCommand = new RelayCommand(ManuallyAdd);

            CheckoutCommand = new RelayCommand(Checkout);
            ChangeCountCommand = new RelayCommand(ChangeCount);
            DeleteCommand = new RelayCommand(Delete);

            UIMediator.Instance.Action = (str) => { StatusText = str; };

            //Показ перекрытия логина.
            OverlayedControl = new ObservableCollection<ViewModelBase> { new LoginControlViewModel(this) };
        }
        public SearchControlViewModel(IOverlayable parent)
        {
            SearchResults = new ObservableCollection<Article>();

            _parent = parent;

            AddCommand = new RelayCommand(Add);
            SearchCommand = new RelayCommand(Search);
            CloseCommand = new RelayCommand(Close);
        }
        public LoggerControlViewModel(IOverlayable parent)
        {
            _parent = parent;
            CloseCommand = new RelayCommand(Close);
            ExportCommand = new RelayCommand(Export);

            var sb = new StringBuilder();
            var hist = HistoryManager.Instance.History;
            foreach (var str in hist)
                sb.AppendLine(str);
            LogText = sb.ToString();
        }
 public LoginControlViewModel(IOverlayable parent)
 {
     InnerLoginCommand = new RelayCommand(Login, IsValidFields);
     _parent = parent;
     parent.Timer.Suspend();
 }
 public UnlockControlViewModel(IOverlayable parent)
 {
     UnlockCommand = new RelayCommand(Unlock, IsValid);
     _parent = parent;
     _username = _parent.Model.Validator.Username;
 }