private void OnStockUpdated(object sender, Support.StockEventArgs e)
 {
     Close();
 }
        /*
                        void OnAddProductTreeCommand(object arg)
                        {
                            CurrentPartViewModel = new EditPartViewModel(_serviceFactory, new Part());
                            CurrentPartViewModel.PartUpdated += CurrentPartViewModel_PartUpdated;
                            CurrentPartViewModel.CancelEditPart += CurrentPartViewModel_CancelEvent;

                            if (OpenEditPartWindow != null) OpenEditPartWindow(this, CurrentPartViewModel);
                        }
*/
        void CurrentStockViewModel_StockUpdated(object sender, StockEventArgs e)
        {
            if (!e.IsNew)
            {
                //ToDo This doesn't update UI
                UpdateProductTree(_productTree, e.Stock);
            }
            else
            {
                //_stocks.Add(new Part(e.Stock));
            }

            CurrentStockViewModel = null;
        }
        void CurrentStockViewModel_StockUpdated(object sender, StockEventArgs e)
        {
            if (!e.IsNew)
            {
                Part stock = _stocks.Single(item => item.Id == e.Stock.Id);
                if (stock != null)
                {
                    stock.Type = e.Stock.Type;
                    stock.Number = e.Stock.Number;
                    stock.Description = e.Stock.Description;
                    stock.IsOwnMake = e.Stock.IsOwnMake;
                    stock.Length = e.Stock.Length;
                    stock.OwnCost = e.Stock.OwnCost;
                    stock.ComponentsCost = e.Stock.ComponentsCost;
                    stock.Count = e.Stock.Count;
                    stock.CountDate = e.Stock.CountDate;
                    stock.OnOrder = e.Stock.OnOrder;
                    stock.Notes = e.Stock.Notes;
                }
            }
            else
            {
                _stocks.Add(new Part(e.Stock));
            }

            CurrentStockViewModel = null;
        }