private void Grid_MouseUp(object sender, MouseButtonEventArgs e) { if (mouseDown) { // Release the mouse capture and stop tracking it. mouseDown = false; captureNextMouseEvent = false; theGrid.ReleaseMouseCapture(); // Hide the drag selection box. selectionBox.Visibility = Visibility.Collapsed; Point mouseUpPos = e.GetPosition(theGrid); View_Model model = (View_Model)DataContext; Rect rect = new Rect(mouseDownPos, mouseUpPos); rect.X /= model.CardRenderWidth; rect.Y /= model.CardRenderHeight; rect.Width /= model.CardRenderWidth; rect.Height /= model.CardRenderHeight; But_Delete_Region.IsEnabled = true; model.AddNewCardRegion(rect); } }
private void but_temp_save_Click(object sender, RoutedEventArgs e) { dia_save.ShowDialog(); View_Model model = (View_Model)DataContext; model.Xml_Save(dia_save.FileName, true); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); View_Model context = new View_Model(); MainWindow app = new MainWindow(context); app.Show(); }
private void but_temp_load_Click(object sender, RoutedEventArgs e) { dia_open.ShowDialog(); View_Model model = (View_Model)DataContext; try { model.Xml_Load(dia_open.FileName, true); } catch { MessageBox.Show("Error Loading File"); } }
void Tree_View_Selection_Changed(Object sender, RoutedPropertyChangedEventArgs <object> e) { View_Model model = (View_Model)DataContext; model.Tree_View_Selected_Item_Changed(); }
private void But_Delete_Region_Click(object sender, RoutedEventArgs e) { View_Model model = (View_Model)DataContext; model.DeleteNextSelectedRegion = true; }