예제 #1
0
        private void cmdAlbumAddProduct_OnClick(object sender, RoutedEventArgs e)
        {
            if (SelectedAlbum == null)
            {
                this.ShowError("Необходимо выбрать альбом.");
                return;
            }

            var p = new Product
                {
                    AlbumId = SelectedAlbum.Id,
                    VkId = Int32.MinValue,
                    Id = Int32.MinValue,
                    MinAmount = 1
                };
            var f = new ProductEditWindow(this, p);
            f.ShowDialog();

            if (f.GetResult() == ProductEditWindow.Result.Saved && m_selectedView == ServiceTreeNodes.AlbumProducts)
            {
                ShowAlbumProductsDetails(SelectedAlbum);
            }
        }
예제 #2
0
        private void AlbumsViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var element = e.OriginalSource as FrameworkElement;
            if (element == null) return;

            if (!(element.Parent is StackPanel)) return;
            var panel = element.Parent as StackPanel;
            if (!(panel.Parent is HeaderedItemsControl)) return;
            var p = ((element.Parent as StackPanel).Parent as HeaderedItemsControl).Tag as Product;

            if (p != null)
            {
                var f = new ProductEditWindow(this, p);
                f.ShowDialog();
                if (f.GetResult() == ProductEditWindow.Result.Saved)
                {
                    (panel.Children[1] as TextBlock).Text = p.Title;
                }
            }
        }