Exemplo n.º 1
0
        private void Devices_CmdCopy_Executed(object sender, ExecutedRoutedEventArgs evt)
        {
            Device device = Devices.First(d => IsSelectedDevice(d));

            if (device is DectDevice dectDevice)
            {
                DectDevice newDevice = new DectDevice(dectDevice)
                {
                    DeviceName = string.Empty
                };
                if (newDevice.Edit(this))
                {
                    Devices.Add(newDevice);
                    Devices_SelectDevice(newDevice);
                }
            }
            if (device is JuisDevice juisDevice)
            {
                JuisDevice newDevice = new JuisDevice(juisDevice)
                {
                    DeviceName = string.Empty
                };
                if (newDevice.Edit(this))
                {
                    Devices.Add(newDevice);
                    Devices_SelectDevice(newDevice);
                }
            }

            Devices_SetDataGridFocus();
        }
Exemplo n.º 2
0
        public DectDevice( DectDevice srcDevice )
        {
            if (srcDevice == null) {
                throw new ArgumentNullException(nameof(srcDevice));
            }

            ID = Guid.NewGuid().ToString();
            CopyFrom(srcDevice);
        }
        public DectDeviceDialog(DectDevice device)
        {
            origDevice = device ?? throw new ArgumentNullException(nameof(device));
            DeviceData = new DectDevice(device);

            InitComboBoxValues(device);
            InitializeComponent();
            DataContext = this;
        }
        private void InitComboBoxValues(DectDevice device)
        {
            CountryValues  = Device.GetCountryValues().AppendMissingAsUnknown(device.Country);
            LanguageValues = Device.GetLanguageValues().AppendMissingAsUnknown(device.Language);
            OEMValues      = Device.GetOemValues().AppendMissingAsUnknown(device.OEM);

            DectBaseValues = new List <ComboBoxValue>();
            foreach (JuisDevice baseDevice in App.GetMainWindow().Devices.Where(d => d is JuisDevice))
            {
                DectBaseValues.Add(new ComboBoxValue(baseDevice.ID, baseDevice.DeviceName));
            }
            DectBaseValues.Sort(new ComboBoxValueComparer(new NaturalStringComparer(App.defaultDisplayStringComparison)));
            DectBaseValues.AppendMissingAsUnknown(device.DectBase);
        }
Exemplo n.º 5
0
        private void Devices_CmdAddDECT_Executed(object sender, ExecutedRoutedEventArgs evt)
        {
            DectDevice newDevice = new DectDevice()
            {
                Country  = programSettings.DefaultCountry,
                Language = programSettings.DefaultLanguage,
                OEM      = programSettings.DefaultOEM
            };

            if (newDevice.Edit(this))
            {
                Devices.Add(newDevice);
                Devices_SelectDevice(newDevice);
            }

            Devices_SetDataGridFocus();
        }