/// <summary> /// Call to load from the XIB/NIB file. /// </summary> /// <param name="dataContext">Data context for the dialog.</param> public SerialPortSelectorDialogController(SerialPortSelectorDialogViewModel dataContext) : base("SerialPortSelectorDialog") { DataContext = dataContext; DataContext.PortSelectorViewModel.PropertyChanged += HandlePortSelectorPropertyChanged; Initialize(); }
private static SerialPortSelectorDialog Create(SerialPortSelectorDialogViewModel viewModel) { var dialogController = new SerialPortSelectorDialogController(viewModel); var dialog = dialogController.Window; dialog.Controller = dialogController; return(dialog); }
private static SerialPortSelectorDialog Create(SerialPortSelectorDialogViewModel viewModel) { System.Windows.Window owner = null; var dialog = owner.Create <SerialPortSelectorDialog>(); dialog.DataContext = viewModel; return(dialog); }
/// <summary> /// Creates an instance of SerialPortSelectorDialog with given parameters. /// </summary> /// <param name="title">Title of the dialog.</param> /// <param name="message">Prompt message for the dialog (e.g. Select port for peripheral)</param> /// <param name="ports">The ports to select from.</param> /// <param name="disabledPorts">Ports in the list to disable.</param> /// <param name="selectedPort">The currently selected port.</param> /// <param name="baudRates">The supported baud rates.</param> /// <param name="defaultBaudRate">The default baud rate.</param> /// <param name="checkPortAvailability">If <c>true</c>, check the port to see if it is already in use before adding it to the selection list.</param> /// <returns>A new instance of the dialog.</returns> /// <param name="inclusionFilter">If <c>null</c> or it returns <c>true</c>, ports are included.</param> public static SerialPortSelectorDialog Create(string title, string message, IEnumerable <string> ports, IEnumerable <string> disabledPorts, string selectedPort, IEnumerable <int> baudRates, int defaultBaudRate, bool checkPortAvailability, System.Predicate <IConnection> inclusionFilter) { var selectPortViewModel = new SerialPortSelectorViewModel(message, ports, disabledPorts, selectedPort, baudRates, defaultBaudRate, checkPortAvailability, inclusionFilter); var viewModel = new SerialPortSelectorDialogViewModel(selectPortViewModel); if (!string.IsNullOrWhiteSpace(title)) { viewModel.Title = title; } var dialog = Create(viewModel); return(dialog); }
/// <summary> /// Initializes a new instance of the <see cref="INTV.Shared.View.SerialPortSelectorDialog"/> class. /// </summary> /// <param name="viewModel">The data context for the dialog.</param> private SerialPortSelectorDialog(SerialPortSelectorDialogViewModel viewModel) : base(string.Empty, INTV.Shared.Utility.SingleInstanceApplication.Instance.MainWindow, Gtk.DialogFlags.Modal) { DataContext = viewModel; this.Build(); _serialPortSelector.Initialize(viewModel.PortSelectorViewModel); buttonOk.Label = viewModel.SelectButtonText; buttonOk.Data[CommandGroup.AttachedCommandPropertyName] = SerialPortSelectorDialogViewModel.SelectPortCommand; HandleCanSelectPortChanged(null, null); INTV.Shared.ComponentModel.CommandManager.RequerySuggested += HandleCanSelectPortChanged; SerialPortSelectorDialogViewModel.SelectPortCommand.CanExecuteChanged += HandleCanSelectPortChanged; buttonCancel.Label = viewModel.CancelButtonText; buttonCancel.Data[CommandGroup.AttachedCommandPropertyName] = SerialPortSelectorDialogViewModel.CancelSelectPortCommand; }
private static SerialPortSelectorDialog Create(SerialPortSelectorDialogViewModel viewModel) { var dialog = new SerialPortSelectorDialog(viewModel); return(dialog); }