コード例 #1
0
        public static void Show(Action <IModbusTransport> transportCreated, IModbusTransport transport = null, Grid parent = null)
        {
            if (transport == null)
            {
                transport = new ModbusRtuTransport();
            }

            var control = new ConfigureTransportView(transport);
            var dialog  = new DialogView(control);

            control.ApplyPressed += (newTransport) => {
                dialog.Close();
                transportCreated(newTransport);
            };
            dialog.Show(parent);
        }
コード例 #2
0
        public SelectTransportView()
        {
            InitializeComponent();

            this.Loaded += (o, e) => {
                var window = Window.GetWindow(this);
                var grid   = window.Content as Grid;
                btEdit.Click += (o1, e1) =>
                                ConfigureTransportView.Show(
                    (transport) =>
                {
                    RefreshWith(transport);
                    TransportChanged?.Invoke(transport);
                },
                    Transport,
                    grid);
            };
        }