コード例 #1
0
        private void OnEditDeviceDetails(object parameter)
        {
            try
            {
                if (SelectedDevice != null)
                {
                    var vm = new EditDeviceViewModel(SelectedDevice, this)
                    {
                        //Set properties if any
                        Title = "[Edit Device Details]"
                    };
                    var dlg = new AddDeviceDialog()
                    {
                        DataContext = vm
                    };

                    if (dlg.ShowDialog() != true)
                    {
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Please select an entry for Edit!", "Edit Device details");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Unexpected error occured during Edit device details. \n" + ex.Message);
            }
        }
コード例 #2
0
        private void OnAddDeviceDetails(object parameter)
        {
            try
            {
                var vm = new AddDeviceViewModel(this)
                {
                    //Set properties if any
                    Title = "[Add Device Details]"
                };
                var dlg = new AddDeviceDialog()
                {
                    DataContext = vm
                };

                if (dlg.ShowDialog() != true)
                {
                    return;
                }
            }

            catch (Exception ex)
            {
                //Custome message can be shown to the user and INeer exception can be logged in a file
                MessageBox.Show("Error occured while adding device details. \n" + ex.Message);
            }
        }
コード例 #3
0
 public DeviceListViewItem()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
     addDeviceDialog          = AddDeviceDialog.GetInstance();
 }