コード例 #1
0
        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);
        }
コード例 #2
0
        public DetailInformationViewModel(MainMetroWindowViewModel mainMetroWindow)
        {
            _mainMetroWindow = mainMetroWindow;

            OpenDetailInformationCommand = new RelayCommand(OpenDetailInformation, CanOpenDetailInformation);
            AddTagCommand    = new DelegateCommand(AddTag, CanAddTag);
            RemoveTagCommand = new DelegateCommand(RemoveTag, CanRemoveTag);
        }
コード例 #3
0
        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);
        }