Exemplo n.º 1
0
 public ViewModel()
 {
     this.RemoveAssemblyInfoCommand = new RelayCommand(
         this.RemoveAssemblyInfo,
         () => !string.IsNullOrEmpty(this.migrated) &&
         !this.migrated.Contains("<GenerateAssemblyInfo>false</GenerateAssemblyInfo>") &&
         this.TryGetAssemblyInfo(out _));
     this.AddAutoGenerateBindingRedirectsCommand = new RelayCommand(
         () => this.Migrated = Migrate.WithAutoGenerateBindingRedirects(this.migrated),
         () => !string.IsNullOrEmpty(this.migrated) &&
         !this.migrated.Contains("<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>"));
 }
Exemplo n.º 2
0
        private void OnOpen(object sender, ExecutedRoutedEventArgs e)
        {
            var dialog = new OpenFileDialog
            {
                Filter = Filter,
            };

            if (dialog.ShowDialog(this) == true)
            {
                var vm = (ViewModel)this.DataContext;
                vm.FileName = dialog.FileName;
                vm.Original = File.ReadAllText(dialog.FileName);
                vm.Migrated = Migrate.ProjectFile(vm.Original, dialog.FileName);
            }
            else
            {
                var vm = (ViewModel)this.DataContext;
                vm.FileName = null;
                vm.Original = string.Empty;
                vm.Migrated = string.Empty;
            }

            e.Handled = true;
        }