Beispiel #1
0
 private void AddMediaDialog_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(addMediaDialog.MediaLink) && !string.IsNullOrWhiteSpace(addMediaDialog.MediaName) && addMediaDialog.RepeatTime > 0)
     {
         var selectedPlaylist = playlists.FirstOrDefault(pl => pl.PlaylistId == (lbxPlaylist.SelectedItem as Playlist).PlaylistId);
         if (selectedPlaylist != null)
         {
             var newMedia = new Media()
             {
                 MediaLink   = addMediaDialog.MediaLink,
                 MediaName   = addMediaDialog.MediaName,
                 MediaTypeId = addMediaDialog.MediaTypeId,
                 PlaylistId  = selectedPlaylist.PlaylistId,
                 RepeatTime  = addMediaDialog.RepeatTime
             };
             try
             {
                 DataHelper.AddMedia(newMedia);
                 updateMediaSource(DataHelper.GetMedias(selectedPlaylist.PlaylistId));
             }
             catch (Exception ex)
             {
                 NotificationHelper.Notice("Không thể thêm media");
                 NotificationHelper.Notice(ex.Message);
             }
         }
     }
 }
Beispiel #2
0
        public Setting()
        {
            InitializeComponent();
            WidthSet               = Static.Setting.Empty.Width.ToString();
            HeightSet              = Static.Setting.Empty.Height.ToString();
            TextXSet               = Static.Setting.Empty.Text.X.ToString();
            TextYSet               = Static.Setting.Empty.Text.Y.ToString();
            NameXSet               = Static.Setting.Empty.Name.X.ToString();
            NameYSet               = Static.Setting.Empty.Name.Y.ToString();
            GlyphScale             = Static.Setting.Empty.GlyphScale.ToString();
            WidthSetting.Text      = WidthSet;
            HeightSetting.Text     = HeightSet;
            TextXSetting.Text      = TextXSet;
            TextYSetting.Text      = TextYSet;
            NameXSetting.Text      = NameXSet;
            NameYSetting.Text      = NameYSet;
            GlyphScaleSetting.Text = GlyphScale;

            ColorList = new BindingList <ColorL>(typeof(Colors).GetProperties().Select(x => new ColorL()
            {
                Name = x.Name, Color = (Color)ColorConverter.ConvertFromString(x.Name)
            }).ToList());
            ColorBackSetting.DataContext = ColorList;
            ColorNameSetting.DataContext = ColorList;
            ColorTextSetting.DataContext = ColorList;
            ColorBack = Static.Setting.Empty.BackgroundColor;
            ColorText = Static.Setting.Empty.Text.Color;
            ColorName = Static.Setting.Empty.Name.Color;
            ColorBackSetting.SelectedItem = ColorList.FirstOrDefault(x => x.Color == ColorBack);
            ColorTextSetting.SelectedItem = ColorList.FirstOrDefault(x => x.Color == ColorText);
            ColorNameSetting.SelectedItem = ColorList.FirstOrDefault(x => x.Color == ColorName);
        }
Beispiel #3
0
        private void Refresh()
        {
            while (true)
            {
                var gs = dbg.ReadAllForLC(Data.Code);

                foreach (var gen in gs)
                {
                    int id = gen.Id;

                    if (generators.FirstOrDefault(g => g.Id == gen.Id) == null)
                    {
                        //Zato sto se ObservableCollection ne moze menjati u drugom threadu
                        //
                        App.Current.Dispatcher.Invoke((Action) delegate
                        {
                            generators.Add(gen);
                        });
                    }
                    else
                    {
                        App.Current.Dispatcher.Invoke((Action) delegate
                        {
                            generators.FirstOrDefault(g => g.Id == id).CurrentPower = gen.CurrentPower;
                            generators.FirstOrDefault(g => g.Id == id).Control      = gen.Control;
                        });
                    }
                }

                Thread.Sleep(500);
            }
        }
Beispiel #4
0
        protected void BtnEditRemoveFlagClick(object sender, EventArgs e)
        {
            var flagThis = new FlagWindow {
                FlagComment = _selectedKey.Comment, CancelButtonText = "Remove"
            };

            if (flagThis.ShowDialog(this) == DialogResult.Abort)
            {
                FileHandler.RemoveFlag(_selectedFile.Name, _selectedKey.Name, flagThis.FlagComment);
                if (chbShowFlaggedOnly.Checked)
                {
                    var itemToRemove = _keysListSource.FirstOrDefault(k => k.File == _selectedFile.Name && k.Name == _selectedKey.Name);
                    _keysListSource.Remove(itemToRemove);
                    FileHandler.StringsCurrentDataSource[_selectedFile.Name].Remove(_selectedKey.Name);
                    if (!_keysListSource.Any())
                    {
                        FileHandler.StringsCurrentDataSource.Remove(_selectedFile.Name);
                        _filesListSource.Remove(_selectedFile);
                    }
                }
            }
            else
            {
                FileHandler.UpdateFlag(_selectedFile.Name, _selectedKey.Name, flagThis.FlagComment);
            }
            RefreshKeysListSelectedItem();
            UpdateFlagsUI();
        }
Beispiel #5
0
        private void OnFilterRadioButtonDER(StackPanel stackPanel)
        {
            fillList();

            RadioButton greater = (RadioButton)stackPanel.Children[3];
            RadioButton less    = (RadioButton)stackPanel.Children[4];

            if (greater.IsChecked == true)
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id < filterDER.Id)).ToList();

                foreach (var item in usersToRemove)
                {
                    DERs.Remove(item);
                }
                if (comboBoxRadioButtonItems.FirstOrDefault(x => x == "Veće od " + filterDER.Id) == null)
                {
                    comboBoxRadioButtonItems.Add("Veće od " + filterDER.Id);
                }
            }

            if (less.IsChecked == true)
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id > filterDER.Id)).ToList();

                foreach (var item in usersToRemove)
                {
                    DERs.Remove(item);
                }
                if (comboBoxRadioButtonItems.FirstOrDefault(x => x == "Manje od " + filterDER.Id) == null)
                {
                    comboBoxRadioButtonItems.Add("Manje od " + filterDER.Id);
                }
            }
        }
        private void btnDeleteRecords_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt64(getIDNumberInput()) == IDNum)
            {
                //int ID = applicationAccountsGrid.SelectedRows[0].Index;

                int ID       = applicationAccountsGrid.CurrentCell.RowIndex + 1; //Rowndex is zero index based
                var listItem = gridList.FirstOrDefault(x => x.Id == ID);

                if (listItem != null)
                {
                    gridList.Remove(listItem);
                }

                this.iApplicationAccount.deleteSelectedAccount(ID);
                gridList = null;
                frmMainPMSVaultForm_Load(null, null);

                text = listItem.applicationName + " deleted!";
                Utility.showLabel(lblError, text, Color.OrangeRed);
            }
            else
            {
                text = "The ID Number you have entered does not \n match with the one stored on record.";
                Utility.showLabel(lblError, text, Color.Red);
            }
        }
        private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            GridItem gridItem = _bindingListAll.FirstOrDefault(a => a.Id == (int)e.UserState);

            if (gridItem != null)
            {
                gridItem.Percentage = e.ProgressPercentage;
                Download download = _context.Downloads.Find(gridItem.Id);

                try
                {
                    if (download != null)
                    {
                        download.Percent = gridItem.Percentage;
                        _context.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                LogMessage("_bindingList.FirstOrDefaul returned null in ProgressChanged", true);
            }
        }
Beispiel #8
0
        private void TraceFlagGrid_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            if (_inChangeHandler == false)
            {
                try
                {
                    _inChangeHandler = true;
                    traceFlagGrid.CommitEdit(DataGridViewDataErrorContexts.Commit);

                    int row = traceFlagGrid.CurrentCell.RowIndex;
                    DataGridViewCell cell = traceFlagGrid["TF", row];
                    int  traceFlagNumber  = (int)cell.Value;
                    bool enabled          = (bool)traceFlagGrid.CurrentCell.Value;

                    TraceFlag traceFlag = _boundTraceFlags.FirstOrDefault(tf => tf.TraceFlagNumber == traceFlagNumber);

                    // Check that any parent trace flags are also enabled
                    if (enabled == true)
                    {
                        if (traceFlag.ParentTraceFlag != null)
                        {
                            TraceFlag parentTraceFlag = _boundTraceFlags.FirstOrDefault(tf => tf.TraceFlagNumber == traceFlag.ParentTraceFlag.Value);
                            if (parentTraceFlag != null)
                            {
                                if (parentTraceFlag.Enabled == false)
                                {
                                    parentTraceFlag.Enabled = true;
                                    _boundTraceFlags.ResetBindings();
                                }
                            }
                        }
                    }

                    // Check that any child trace flags are disabled
                    if (enabled == false)
                    {
                        List <TraceFlag> childTraceFlags = _boundTraceFlags.Where(tf => tf.ParentTraceFlag == traceFlag.TraceFlagNumber).ToList();
                        int itemsChanged = 0;
                        foreach (TraceFlag childTraceFlag in childTraceFlags)
                        {
                            if (childTraceFlag.Enabled == true)
                            {
                                childTraceFlag.Enabled = false;
                                itemsChanged++;
                            }
                        }
                        if (itemsChanged > 0)
                        {
                            _boundTraceFlags.ResetBindings();
                        }
                    }
                }
                finally
                {
                    _inChangeHandler = false;
                }
            }
        }
        private void RemoveClientCursorPosition(string clientName)
        {
            var find = clientCursorPositions.FirstOrDefault(c => c.ClientName == clientName);

            if (find != null)
            {
                clientCursorPositions.Remove(find);
            }
        }
        public void EliminarItem(string autoId)
        {
            var it = _bl.FirstOrDefault(f => f.id == autoId);

            if (it != null)
            {
                _bl.Remove(it);
            }
        }
Beispiel #11
0
        public void ActualizarItem(OOB.LibSistema.Vendedor.Entidad.Ficha ficha)
        {
            var it  = _bl.FirstOrDefault(f => f.id == ficha.id);
            var idx = _bl.IndexOf(it);

            _bl.Remove(it);
            _bl.Insert(idx, new dataLista(ficha));
            _bs.CurrencyManager.Refresh();
        }
Beispiel #12
0
        private void OnThreadExitedWorkingArea(string name)
        {
            var selectedThread = _workingThreads.FirstOrDefault(thrd => thrd.Name == name);

            if (selectedThread == null)
            {
                return;
            }
            _workingThreads.Remove(selectedThread);
        }
        public void Eliminar(int e)
        {
            var it = _bl.FirstOrDefault(f => f.Id == e);

            if (it != null)
            {
                _bl.Remove(it);
            }
            _bs.CurrencyManager.Refresh();
        }
Beispiel #14
0
        void Update(Customer customer)
        {
            var customerView = Customers.FirstOrDefault(c => c.customer.CustomerId == customer.CustomerId);

            if (customerView != null)
            {
                customerView.customer = customer;
                dataGrid.RefreshData();
            }
        }
        public void ActualizarItem(OOB.LibInventario.Concepto.Ficha ficha)
        {
            var it = blLista.FirstOrDefault(f => f.id == ficha.auto);

            if (it != null)
            {
                blLista.Remove(it);
            }
            Agregar(ficha);
        }
        public void Agregar(data dat)
        {
            blLista.Add(dat);
            var l = blLista.ToList();

            setLista(l);

            var ind = blLista.IndexOf(blLista.FirstOrDefault(f => f.id == dat.id));

            bsLista.Position = ind;
        }
Beispiel #17
0
        public void UpdateValue(string name, string value)
        {
            //Ensure that the reference exists before updating this value
            //Needed because SetValue is creating the reference if it doesn't exist and when removing  reference it's a problem
            var settingUpdated = Settings.FirstOrDefault(s => s.Name == name);

            if (settingUpdated != null)
            {
                settingUpdated.Value = value;
            }
            OnPropertyChanged("Settings");
        }
Beispiel #18
0
        private void SignalRHub_ClientDisconnected(string clientId)
        {
            //Remove client from the list
            var client = _clients.FirstOrDefault(x => x.Id == clientId);

            if (client != null)
            {
                _clients.Remove(client);
            }

            WriteToLog($"Client disconnected:{clientId} Name:{client.Name}");
        }
Beispiel #19
0
        /// <summary>
        /// Удаление компании по ее ID
        /// </summary>
        public static void DeleteCompany(int id)
        {
            Company foundCompany = companies.FirstOrDefault(x => x.Id == id);

            if (foundCompany != null)
            {
                companies.Remove(foundCompany);
            }
            else
            {
                throw new KeyNotFoundException();
            }
        }
Beispiel #20
0
        };                                                                                                                                              //c06fc555902938b41cdc7018de6a9250a8658064c34d8fb05dbe9087be3b5cd4

        public static Person FindPersonByID(int id)
        {
            return(People.FirstOrDefault(person => person.Id == id));

            /*foreach (var person in People)
             * {
             *      if (person.Id == id)
             *      {
             *              return person;
             *      }
             * }
             * return null;*/
        }
        private void DGVReceiptsDespatchsItems_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (inload)
            {
                return;
            }
            inload = true;
            if (DGVReceiptsDespatchsItems.Columns[e.ColumnIndex].Name == "ArticleNoUnbound")
            {
                if (DGVReceiptsDespatchsItems.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null || DGVReceiptsDespatchsItems.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "")
                {
                    // ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).Item = null;
                    //((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).ItemID = 0;
                    ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).ArticleNo = null;
                    ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).ItemPrice = 0;
                }
                else
                {
                    Data.Model.Article pronadjen = listaArtikla.FirstOrDefault(x => x.ArticleNo == DGVReceiptsDespatchsItems.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                    if (pronadjen != null)
                    {
                        // ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).Item = (pronadjen);
                        ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).ItemID    = (pronadjen.ID);
                        ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).ArticleNo = pronadjen.ArticleNo;
                        ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem).ItemPrice = pronadjen.ItemPrice;
                    }
                    else
                    {
                        DGVReceiptsDespatchsItems.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
                        DGVReceiptsDespatchsItems.Refresh();
                    }
                }
            }
            if (DGVReceiptsDespatchsItems.Columns[e.ColumnIndex].Name == "ArticleNo")
            {
                var stavka = ((DocumentItem)DGVReceiptsDespatchsItems.Rows[e.RowIndex].DataBoundItem);
                Data.Model.Article pronadjen = listaArtikla.FirstOrDefault(x => x.ArticleNo == stavka.ArticleNo);
                //Article pronadjen = stavka.Item;
                if (pronadjen != null)
                {
                    stavka.ItemID = pronadjen.ID;
                    // stavka.Item = (pronadjen);
                    stavka.ArticleNo = pronadjen.ArticleNo;
                    stavka.ItemPrice = pronadjen.ItemPrice;
                    DGVReceiptsDespatchsItems.Rows[e.RowIndex].Cells["ArticleNoUnbound"].Value = pronadjen.ArticleNo;
                }
            }

            inload = false;
            DGVReceiptsDespatchsItems.Refresh();
        }
        private bool DevolverItem(int id)
        {
            var rt = false;

            var it = _blitems.FirstOrDefault(f => f.Id == id);

            if (it != null)
            {
                if (it.EsPesado)
                {
                    Helpers.Msg.Error("PRODUCTO PESADO DEBE SER ELIMINADO POR COMPLETO");
                    return(false);
                }

                if (it.Cantidad == 1)
                {
                    if (EliminarItem(it.Id))
                    {
                        it.setDisminuyeCantidad(1);
                        return(true);
                    }
                }
                else
                {
                    if (_modoFactura)
                    {
                        var ficha = new OOB.Venta.Item.ActualizarCantidad.Disminuir.Ficha()
                        {
                            idOperador   = it.Ficha.idOperador,
                            idItem       = it.Ficha.id,
                            autoProducto = it.Ficha.autoProducto,
                            autoDeposito = it.Ficha.autoDeposito,
                            cantUndBloq  = it.ContenidoEmp,
                            cantidad     = 1,
                        };
                        var r01 = Sistema.MyData.Venta_Item_ActualizarCantidad_Disminuir(ficha);
                        if (r01.Result == OOB.Resultado.Enumerados.EnumResult.isError)
                        {
                            Helpers.Msg.Error(r01.Mensaje);
                            return(false);
                        }
                    }
                    it.setDisminuyeCantidad(1);
                    Helpers.Sonido.SonidoOk();
                    _bsitems.CurrencyManager.Refresh();
                    return(true);
                }
            }

            return(rt);
        }
Beispiel #23
0
        private void SimpleHub_ClientDisconnected(string clientId)
        {
            //Remove client from the list
            this.BeginInvoke(new Action(() =>
            {
                var client = _clients.FirstOrDefault(x => x.Id == clientId);
                if (client != null)
                {
                    _clients.Remove(client);
                }
            }));

            writeToLog($"Client disconnected:{clientId}");
        }
Beispiel #24
0
 private void RemoveLanguageFromProject(ProjectDetails selectedProject)
 {
     foreach (var language in selectedProject.ProjectLanguages)
     {
         if (!language.Equals(new KeyValuePair <string, bool>()))
         {
             var languageToBeDeleted = _languages.FirstOrDefault(l => l.LanguageName.Equals(language.Key));
             if (languageToBeDeleted != null)
             {
                 _languages.Remove(languageToBeDeleted);
             }
         }
     }
 }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            var    textBox = (TextBox)sender;
            string text    = textBox.Text;

            if (!string.IsNullOrWhiteSpace(text))
            {
                Satellite satellite =
                    _satellites.FirstOrDefault((s => s.Name.ToLower().StartsWith(text.ToLower())));
                if (satellite != null)
                {
                    Console.WriteLine("Found satellite: " + satellite);
                }
            }
        }
Beispiel #26
0
        private void button3_Click(object sender, EventArgs e)
        { // Remove from list
            if (dataGridView2.CurrentRow == null || dataGridView2.CurrentRow.Index < 0)
            {
                return;
            }
            var selected = dataGridView2.CurrentRow;
            var action   = _actions.FirstOrDefault(x => x.Name.Equals(selected.Cells["Name"].Value) && x.Version.Equals(selected.Cells["Version"].Value));

            if (action != null)
            {
                _actions.Remove(action);
                UpdateGridview();
            }
        }
Beispiel #27
0
        internal void UpdateContractDetail(ContractDetail contractDetail)
        {
            contractDetails.Add(contractDetail);
            if (contractDetail.ContractDetails.MarketRuleIds != null)
            {
                foreach (int marketRuleId in contractDetail.ContractDetails.MarketRuleIds)
                {
                    clientManager.RequestMarketRule(marketRuleId);
                }
            }

            BuyOrder buyOrder = buyOrders.FirstOrDefault(x => x.Id == contractDetail.ReqId);

            buyOrder.MinTick = (decimal)contractDetail.ContractDetails.MinTick;
        }
Beispiel #28
0
        public ReportExporterControl(List <string> studioProjectsPath)
        {
            InitializeComponent();
            InitializeSettings();
            _messageBoxService = new MessageBoxService();

            foreach (var path in studioProjectsPath)
            {
                var selectedProject = _projectsDataSource.FirstOrDefault(p => p.ProjectPath.Equals(path));
                if (selectedProject != null)
                {
                    PrepareProjectToExport(selectedProject);
                }
            }
            RefreshProjectsListBox();
        }
Beispiel #29
0
        public void execute(BindingList <NameMacro> tableNMacro, BindingList <Variable> tableV, BindingList <BodyMacro> tableMacro, BindingList <Instruction> tom)
        {
            tableV.Clear();
            var macro = tableNMacro.FirstOrDefault(i => i.Name == data.lable);

            if (macro == null)
            {
                throw new ArgumentException($"Макроопределение {data.lable} неопределенно");
            }

            Config.getInstance().stack.Push(macro.Name);

            _startMacro = macro.StartIndex;
            int callMacroCount = macro.EndIndex;

            string mArg1 = macro.Arg1;
            string mArg2 = macro.Arg2;

            if (mArg1.isEmpty() && data.args?.get(0)?.isNotEmpty() == true ||
                mArg2.isEmpty() && data.args?.get(1)?.isNotEmpty() == true ||
                data.args?.get(0)?.isNotEmpty() == true && Utils.validArgKey.IsMatch(mArg1) && !Utils.validArgKey.IsMatch(data.args?.get(0)) ||
                data.args?.get(1)?.isNotEmpty() == true && Utils.validArgKey.IsMatch(mArg2) && !Utils.validArgKey.IsMatch(data.args?.get(1))
                )
            {
                throw new ArgumentException("Неправильные параметры были переданы в макрос");
            }

            tableV.Add(buildVariable(mArg1, data.args?.get(0)));
            var secondVar = buildVariable(mArg2, data.args?.get(1));

            if (secondVar != null)
            {
                tableV.Add(secondVar);
            }
        }
        private void frm_submitEvent(object sender, FormPurchaseOrderCreateBySupplyer.SubmitEventArgs e)
        {
            this.label4.Text = ((FormPurchaseOrderCreateBySupplyer)sender).Supplyer;

            this.dataGridView1.DataSource = bList;

            this.dataGridView1.Focus();

            Guid sid = Guid.Parse(((FormPurchaseOrderCreateBySupplyer)sender).SupplyerID);

            if (_SupplyID != Guid.Empty && _SupplyID != sid)
            {
                bList.Clear();
            }

            foreach (var c in e.listDrug)
            {
                if (bList.FirstOrDefault(r => r.ProductGeneralName == c.ProductGeneralName && r.DictionaryDosageCode == c.DictionaryDosageCode && r.DictionarySpecificationCode == c.DictionarySpecificationCode && r.FactoryName == c.FactoryName) == null)
                {
                    bList.Add(c);
                }
            }

            _SupplyID = sid;

            foreach (DataGridViewRow d in this.dataGridView1.Rows)
            {
                d.Cells[clmSupplyUnitId.Name].Value = ((FormPurchaseOrderCreateBySupplyer)sender).SupplyerID;
                d.Cells[clmSupplyName.Name].Value   = ((FormPurchaseOrderCreateBySupplyer)sender).Supplyer;
            }

            this.Bcms.Sid = sid;        //右键查看供货商基础信息
        }
		public ZoneSelectationViewModel(Device device)
		{
			Title = "Выбор зоны устройства " + device.PresentationAddressAndName;
			CreateCommand = new RelayCommand(OnCreate);
			EditCommand = new RelayCommand(OnEdit, CanEdit);

			Device = device;
			IsGuardDevice = (device.Driver.DeviceType == DeviceType.Sequrity);

			Zones = new BindingList<ZoneViewModel>();
			foreach (var zone in from zone in FiresecManager.Zones orderby zone.No select zone)
			{
				var isGuardZone = (zone.ZoneType == ZoneType.Guard);
				if (isGuardZone ^ IsGuardDevice)
					continue;

				if (device.Driver.DriverType == DriverType.StopButton || device.Driver.DriverType == DriverType.StartButton || device.Driver.DriverType == DriverType.AutomaticButton)
				{
					if (!zone.DevicesInZone.Any(x => x.Driver.DriverType == DriverType.MPT))
						continue;
				}

				var zoneViewModel = new ZoneViewModel(zone);
				Zones.Add(zoneViewModel);
			}
			if (Device.Zone != null)
				SelectedZone = Zones.FirstOrDefault(x => x.Zone == Device.Zone);
		}
		protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
		{
			base.OnPropertyChanged(e);
			
			if (e.Property == BrushProperty) {
				if (Brush != null) {
					GradientStops = new BindingList<GradientStop>(Brush.GradientStops);
					SelectedStop = GradientStops.FirstOrDefault();
				}
				else {
					GradientStops = null;
				}
			}
		}