/// <summary> /// Fires when user presses 'Edit' button on pop-up window. /// </summary> /// <param name="sender">The button New that the action is for.</param> /// <param name="e">Arguments that the implementor of this event may find useful.</param> private void SetTargetEditingOrder(object sender, RoutedEventArgs e) { try { if (OrdersList.SelectedItems.Count == 1) { var selectedItem = (dynamic)OrdersList.SelectedItems[0]; _order = _storage.Retrieve(selectedItem.Key); DataContext = _order; } } catch (Exception exc) { Util.Error("Can't set order for editing", exc.Message); } OrdersList.SelectedItem = null; OrdersExplorer.IsOpen = false; EditOrderButton.IsEnabled = false; DeletOrderButton.IsEnabled = false; WindowMain.IsEnabled = true; Opacity = 1; Effect = null; }