示例#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);
            }
        }
 private void OnKeyUp(object sender, KeyEventArgs keyEventArgs)
 {
     if (keyEventArgs.Key == Key.Escape)
     {
         Close();
     }
     else if (keyEventArgs.Key == Key.P)
     {
         var f = new ProductEditWindow(this, m_product);
         f.ShowDialog();
     }
 }
示例#3
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;
                }
            }
        }
 private void btnEditProduct_Click(object sender, RoutedEventArgs e)
 {
     var f = new ProductEditWindow(this, m_product);
     f.ShowDialog();
 }