Пример #1
0
        public LogWindow(BaseControlProperties baseControlProperties, string header)
        {
            InitializeComponent();
            _vm         = baseControlProperties;
            Title       = $"Log: {header}";
            DataContext = _vm;

            WarnIfLargeLog();
            Log.TextChanged += (sender, args) => WarnIfLargeLog();
        }
 public static RelayCommand CreateDownloadCommand(BaseControlProperties vm, TextBlock progressIndicator)
 {
     return(new RelayCommand(o =>
     {
         progressIndicator.Visibility = Visibility.Visible;
         vm.StartDownload();
     },
                             //Download button is only enabled when both a source and target have been chosen.
                             o => !string.IsNullOrWhiteSpace(vm.Source) && !string.IsNullOrWhiteSpace(vm.TargetFolder)));
 }
 public static RelayCommand CreateSelectFolderCommand(BaseControlProperties vm)
 {
     return(new RelayCommand(o =>
     {
         var dialog = new FolderBrowserDialog();
         var result = dialog.ShowDialog();
         if (result == DialogResult.OK)
         {
             vm.TargetFolder = dialog.SelectedPath;
         }
     }));
 }
 public static RelayCommand CreateLogCommand(BaseControlProperties vm, UserControl control, string header)
 {
     return(new RelayCommand(o =>
     {
         var logWindow = new LogWindow(vm, header)
         {
             Height = control.ActualHeight,
             Width = control.ActualWidth
         };
         logWindow.Show();
     }));
 }