public MainWindow() { InitializeComponent(); services = new WPFServices(); configViewModel = new ConfigurationWindowViewModel(); DataContext = ViewModel = new MainWindowViewModel(services, configViewModel); // Change mouse cursor when processing files this.WhenAnyValue(x => x.ViewModel.IsProcessingFiles) .ObserveOnDispatcher() .Subscribe(processing => Cursor = processing ? Cursors.AppStarting : Cursors.Arrow); // Show child windows when needed ViewModel.OpenChildWindow .ObserveOnDispatcher() .Subscribe(ShowChildWindow); // Close file(s) when user clicks delete Observable.FromEventPattern <KeyEventArgs>(filesListView, "KeyUp") .Where(e => e.EventArgs.Key == Key.Delete && (e.Sender as ListView)?.SelectedItem is not null) .Select(_ => Unit.Default) .InvokeCommand(ViewModel.CloseFile); // Set listview to sort by filename CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ViewModel.XMLProcessors); view.SortDescriptions.Add(new SortDescription(nameof(XMLProcessor.XMLFileName), ListSortDirection.Ascending)); ViewModel.RemoveDD.IsExecuting .ObserveOnDispatcher() .Subscribe(executing => Cursor = executing ? Cursors.AppStarting : Cursors.Arrow); Focus(); }
public ConfigurationWindow() { this.ViewModel = new ConfigurationWindowViewModel(); this.InitializeComponent(); this.DataContext = this.ViewModel; }
public ConfigurationWindow(ConfigurationWindowViewModel viewModel) { InitializeComponent(); DataContext = viewModel; this.FindControl <Button>("CloseButton").Click += (s, e) => Close(); }
public ConfigurationWindow(ConfigurationWindowViewModel vm) : base(vm) { BorderStyleKeyName = "ConfigurationWindowBorderStyle"; InitializeComponent(); MinHeight = ActualHeight;//overide the MiniHeight set by window base MinimizeButtonState = YoYoStudio.Controls.CustomWindow.WindowButtonState.Disabled; MaximizeButtonState = YoYoStudio.Controls.CustomWindow.WindowButtonState.Disabled; screenCapture.ScreenCaputreCancelled += screenCapture_ScreenCaputreCancelled; screenCapture.ScreenCaputred += screenCapture_ScreenCaputred; ActiveConfiguration = vm.CurrentConfigurationItemVM; }
/// <summary> /// Создает окно для редактирования выбранного источника /// </summary> public void CreateUpdateConfigurationView(Source source) { var view = new ConfigurationWindow(); var viewModel = new ConfigurationWindowViewModel(source); if (viewModel.CloseAction == null) { viewModel.CloseAction = new Action(view.Close); } view.DataContext = viewModel; view.ShowDialog(); }
public MainWindow() { InitializeComponent(); services = new AvaloniaServices(this); configViewModel = new ConfigurationWindowViewModel(); DataContext = ViewModel = new MainWindowViewModel(services, configViewModel); // Change mouse cursor when processing files this.WhenAnyValue(x => x.ViewModel.IsProcessingFiles) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(processing => Cursor = processing ? new Cursor(StandardCursorType.AppStarting) : new Cursor(StandardCursorType.Arrow)); // Show child windows when needed ViewModel.OpenChildWindow .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(async type => await ShowChildWindow(type)); ListBox processorList = this.FindControl <ListBox>("listBox"); processorList.SelectionChanged += (s, arg) => ViewModel.SelectedItems = (s as ListBox) !.SelectedItems;
public ConfigurationWindow() { InitializeComponent(); DataContext = new ConfigurationWindowViewModel(); }
public ConfigurationWindow(ConfigurationWindowViewModel viewModel) { InitializeComponent(); DataContext = viewModel; }
private void ConfigurationWindow_Loaded(object sender, RoutedEventArgs e) { this._viewModel = new ConfigurationWindowViewModel(_configuration); this.DataContext = _viewModel; }