public CategoriesPanelViewModel(MainMetroWindowViewModel mainMetroWindow)
        {
            _mainMetroWindow = mainMetroWindow;

            _categoriesCachePath = ConfigurationManager.AppSettings["CategoriesCachePath"];

            using (var stream = new FileStream(_categoriesCachePath, FileMode.OpenOrCreate))
            {
                var serializer = new DataContractSerializer(typeof(List <CategoryViewModel>));

                try
                {
                    var categories = (List <CategoryViewModel>)serializer.ReadObject(stream);

                    Categories = new ObservableCollection <CategoryViewModel>(categories);
                }
                catch (Exception ex)
                {
                    Categories = new ObservableCollection <CategoryViewModel>();
                }
            }

            AddCategoryCommand      = new DelegateCommand(AddCategory, CanAddCategory);
            RemoveCategoryCommand   = new DelegateCommand(RemoveCategory, IsCategorySelected);
            AddTagCommand           = new DelegateCommand(AddTag, CanAddTag);
            RemoveTagCommand        = new DelegateCommand(RemoveTag, CanRemoveTag);
            ActivateCategoryCommand = new DelegateCommand(ActivateCategory, IsCategorySelected);
        }
Exemplo n.º 2
0
        public DetailInformationViewModel(MainMetroWindowViewModel mainMetroWindow)
        {
            _mainMetroWindow = mainMetroWindow;

            OpenDetailInformationCommand = new RelayCommand(OpenDetailInformation, CanOpenDetailInformation);
            AddTagCommand    = new DelegateCommand(AddTag, CanAddTag);
            RemoveTagCommand = new DelegateCommand(RemoveTag, CanRemoveTag);
        }
        public ImageControlsViewModel(MainMetroWindowViewModel mainMetroWindow)
        {
            _mainMetroWindow = mainMetroWindow;
            DetailInfo       = new DetailInformationViewModel(mainMetroWindow);

            SwitchPictureLeftCommand         = new RelayCommand(SwitchPictureLeft, CanSwitchPictureLeft);
            SwitchPictureRightCommand        = new RelayCommand(SwitchPictureRight, CanSwitchPictureRight);
            ActivateFullScreenModeCommand    = new DelegateCommand(p => _mainMetroWindow.IsFullScreenModeActivated = true);
            ActivateDefaultScreenModeCommand = new DelegateCommand(p => _mainMetroWindow.IsFullScreenModeActivated = false);
            OpenInExplorerCommand            = new RelayCommand(OpenInExplorer, IsPictureSelected);
            DeletePictureCommand             = new RelayCommand(DeletePicture, IsPictureSelected);
            VkPostCommand           = new RelayCommand(VkPost, IsPictureSelected);
            OpenCloudStorageCommand = new DelegateCommand(OpenCloudStorage);
        }