コード例 #1
0
        public LogWindow(BaseControlProperties baseControlProperties, string header)
        {
            InitializeComponent();
            _vm         = baseControlProperties;
            Title       = $"Log: {header}";
            DataContext = _vm;

            WarnIfLargeLog();
            Log.TextChanged += (sender, args) => WarnIfLargeLog();
        }
コード例 #2
0
 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)));
 }
コード例 #3
0
 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;
         }
     }));
 }
コード例 #4
0
 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();
     }));
 }