コード例 #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();
        }
コード例 #2
0
ファイル: DectDevice.cs プロジェクト: coder66/avm_juischeck
        public DectDevice( DectDevice srcDevice )
        {
            if (srcDevice == null) {
                throw new ArgumentNullException(nameof(srcDevice));
            }

            ID = Guid.NewGuid().ToString();
            CopyFrom(srcDevice);
        }
コード例 #3
0
        public DectDeviceDialog(DectDevice device)
        {
            origDevice = device ?? throw new ArgumentNullException(nameof(device));
            DeviceData = new DectDevice(device);

            InitComboBoxValues(device);
            InitializeComponent();
            DataContext = this;
        }
コード例 #4
0
        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);
        }
コード例 #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();
        }