private void CheckDeviceExecute(object obj)
        {
            DeviceNode node = obj as DeviceNode;

            if (node == null)
            {
                return;
            }

            //Check the same item, keep it.
            if (node.IsChecked == false)
            {
                node.IsChecked = true;
                return;
            }
            SelectedDevice = node;
            //unchecked other menuitem
            DeviceNode checkedItem = DevicesList.FirstOrDefault(x => x.IsChecked == true && x != node);

            if (checkedItem != null)
            {
                checkedItem.IsChecked = false;
            }
            //Check current node
            CheckDeviceView(node);

            _document.IsDirty = true;
        }
Exemplo n.º 2
0
        private void Swap(DeviceNode node)
        {
            int item = node.Width;

            node.Width  = node.Height;
            node.Height = item;
        }
Exemplo n.º 3
0
        public void MoveDown(DeviceNode node)
        {
            int index = DeviceList.IndexOf(node);

            DeviceList.Remove(node);
            DeviceList.Insert(++index, node);
            _deviceSet.MoveDevice(node.Name, 1);
        }
Exemplo n.º 4
0
        public DeviceNode AddDevice()
        {
            IDevice    device = _deviceSet.CreateDevice(GetNoteName());
            DeviceNode node   = new DeviceNode(device);

            DeviceList.Add(node);
            return(node);
        }
Exemplo n.º 5
0
        private void MoveDownExecute(object obj)
        {
            DeviceNode node = selectValue;

            _model.MoveDown(selectValue);
            SelectValue       = node;
            _document.IsDirty = true;
        }
Exemplo n.º 6
0
        private void AddDeviceExecute(object obj)
        {
            DeviceNode node = _model.AddDevice();

            node.IsNodeEditable = true;
            SelectValue         = node;
            _document.IsDirty   = true;
        }
Exemplo n.º 7
0
        private bool IsNameCollision(string name)
        {
            DeviceNode node = DeviceModel.GetInstance().DeviceList.FirstOrDefault(x => x.Name == name);

            if ((node != null && node != this) || name == CommonDefine.PresetOff)
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Select one device in device menu
        /// </summary>
        /// <param name="view"></param>
        private void CheckDeviceView(DeviceNode view)
        {
            if (view == null)
            {
                return;
            }
            bUserSetting   = false;
            EditableWidth  = view.Width;
            EditableHeight = view.Height;
            bUserSetting   = true;

            SelectedDevice = view;
            UpdateDeviceBox();
        }
        public void CheckDevices()
        {
            //_deviceModel.LoadDevices();

            DeviceNode selectedItem = DevicesList.FirstOrDefault(x => x.IsChecked == true);

            //Current select is null, select off item.
            if (selectedItem == null)
            {
                selectedItem = DevicesList.FirstOrDefault(x => x.Name == CommonDefine.PresetOff);
                if (selectedItem != null)
                {
                    selectedItem.IDevice.IsChecked = true;
                }
            }
            FirePropertyChanged("IsDeviceOn");
            CheckDeviceView(selectedItem);
        }
Exemplo n.º 10
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(false);
            }
            return(true);

            DeviceNode node = (DeviceNode)value;

            if (node.Type == DeviceType.None)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 11
0
 public void Delete(DeviceNode node)
 {
     DeviceList.Remove(node);
     _deviceSet.DeleteDevice(node.IDevice);
 }