コード例 #1
0
        public ImgurControl()
        {
            InitializeComponent();

            _vm              = (Application.Current as App).Container.GetService <ImgurControlViewModel>();
            _vm.Download     = SharedEventHandlingLogic.CreateDownloadCommand(_vm, ProgressIndicator);
            _vm.ShowLog      = SharedEventHandlingLogic.CreateLogCommand(_vm, this, "Imgur");
            _vm.SelectFolder = SharedEventHandlingLogic.CreateSelectFolderCommand(_vm);

            ProgressIndicator.Visibility = Visibility.Hidden;
            DataContext = _vm;
        }
コード例 #2
0
        public LocalControl()
        {
            InitializeComponent();

            _vm              = (Application.Current as App).Container.GetService <LocalControlViewModel>();
            _vm.Download     = SharedEventHandlingLogic.CreateDownloadCommand(_vm, ProgressIndicator);
            _vm.ShowLog      = SharedEventHandlingLogic.CreateLogCommand(_vm, this, "Local files");
            _vm.SelectFolder = SharedEventHandlingLogic.CreateSelectFolderCommand(_vm);

            _vm.SelectSourceFolder = new RelayCommand(o =>
            {
                var dialog = new FolderBrowserDialog();
                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _vm.Source = dialog.SelectedPath;
                }
            });

            ProgressIndicator.Visibility = Visibility.Hidden;
            DataContext = _vm;
        }
コード例 #3
0
        public RedditControl()
        {
            InitializeComponent();
            _vm = (Application.Current as App).Container.GetService <RedditControlViewModel>();

            //Radiobutton command
            _vm.PullCommand = new RelayCommand(o =>
            {
                if (_vm.PullParam == "top")
                {
                    RadioTopAll.IsEnabled   = true;
                    RadioTopYear.IsEnabled  = true;
                    RadioTopMonth.IsEnabled = true;
                    RadioTopWeek.IsEnabled  = true;
                    RadioTopDay.IsEnabled   = true;
                    RadioTopHour.IsEnabled  = true;
                }
                else
                {
                    RadioTopAll.IsEnabled   = false;
                    RadioTopYear.IsEnabled  = false;
                    RadioTopMonth.IsEnabled = false;
                    RadioTopWeek.IsEnabled  = false;
                    RadioTopDay.IsEnabled   = false;
                    RadioTopHour.IsEnabled  = false;
                }
            });

            //Checkboxes
            _vm.CustomQueryCommand = new RelayCommand(o =>
            {
                if (_vm.CustomQuery)
                {
                    RadioPullMain.IsEnabled          = false;
                    RadioPullTop.IsEnabled           = false;
                    RadioPullControversial.IsEnabled = false;
                    RadioPullRising.IsEnabled        = false;
                    RadioPullNew.IsEnabled           = false;

                    RadioTopAll.IsEnabled   = false;
                    RadioTopYear.IsEnabled  = false;
                    RadioTopMonth.IsEnabled = false;
                    RadioTopWeek.IsEnabled  = false;
                    RadioTopDay.IsEnabled   = false;
                    RadioTopHour.IsEnabled  = false;
                }
                else
                {
                    RadioPullMain.IsEnabled          = true;
                    RadioPullTop.IsEnabled           = true;
                    RadioPullControversial.IsEnabled = true;
                    RadioPullRising.IsEnabled        = true;
                    RadioPullNew.IsEnabled           = true;
                    _vm.PullCommand.Execute(null);
                }
            });
            //Disable the "save albums in nested folders" checkbox if we're skipping albums.
            _vm.SkipAlbumsCommand = new RelayCommand(o => { SaveAlbumsInFoldersCheckbox.IsEnabled = !_vm.SkipAlbums; });

            //Buttons
            _vm.Download     = SharedEventHandlingLogic.CreateDownloadCommand(_vm, ProgressIndicator);
            _vm.ShowLog      = SharedEventHandlingLogic.CreateLogCommand(_vm, this, "Reddit");
            _vm.SelectFolder = SharedEventHandlingLogic.CreateSelectFolderCommand(_vm);

            _vm.PullCommand.Execute(null);
            ProgressIndicator.Visibility = Visibility.Hidden;
            DataContext = _vm;
        }