public void SelectRect(string rectname) { if (selected_rectangle != null) { selected_rectangle.Unselect(); } selected_rectangle = SomeUtilities.FindChild <RectangleNamed>(canvas1, rectname); selected_rectangle.Select(); }
//Universal metod for item add/delete checkboxes private void CheckBox_Checked_1(object sender, RoutedEventArgs e) { Element.types typeOfElement; string str = ((CheckBox)sender).Name; Rectangle foundRectangle = SomeUtilities.FindChild <Rectangle>(grid1, str.Replace("cb", "rctngl")); if (!cbManualChangeState) { typeOfElement = Element.GetType(str.Replace("cb_", "")); onElementCreate(str.Replace("cb_", ""), typeOfElement, foundRectangle.Fill, 0.5); } }
private void btn_fontPath_Click(object sender, RoutedEventArgs e) { string toollName = ((Button)sender).Name; toollName = toollName.Replace("btn", "tb"); string themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml"; TextBox foundTextBox = SomeUtilities.FindChild <TextBox>(this, toollName); string filename = SomeUtilities.openFileDialog("Font files(*.ttf)|*.ttf" + "|Все файлы (*.*)|*.* ", foundTextBox.Text, themeFilename); if (filename != null) { foundTextBox.Text = filename; } }
private void btn_BringToFront_Click(object sender, RoutedEventArgs e) { try { if (selected_rectangle != null) { RectangleNamed pToMove = SomeUtilities.FindChild <RectangleNamed>(canvas1, selected_rectangle.Name); canvas1.Children.Remove(pToMove); canvas1.Children.Add(pToMove); } } catch (Exception) { } }
private void btn_getimagefile_Click(object sender, RoutedEventArgs e) { string toollName = ((Button)sender).Name; toollName = toollName.Replace("btn", "tb"); string themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml"; TextBox foundTextBox = SomeUtilities.FindChild <TextBox>(canvas, toollName); string filename = SomeUtilities.openFileDialog("Image files(*.png;*.jpg;*.svg)|*.png;*.jpg;*.svg" + "|Все файлы (*.*)|*.* ", foundTextBox.Text, themeFilename); if (!string.IsNullOrEmpty(filename)) { foundTextBox.Text = filename; } //saveSystemView(); }
private void btn_path_Click(object sender, RoutedEventArgs e) { string toollName = ((Button)sender).Name; toollName = toollName.Replace("btn", "tb"); string themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml"; TextBox foundTextBox = SomeUtilities.FindChild <TextBox>(this, toollName); string filename = SomeUtilities.openFileDialog("Image files(*.png;*.jpg;*.svg)|*.png;*.jpg;*.svg" + "|Все файлы (*.*)|*.* ", foundTextBox.Text, themeFilename); if (filename != null) { manualClear = true; foundTextBox.Text = filename; manualClear = false; onPropertyChanged(((Button)sender).Name.Replace("btn_", ""), filename); } }
public void propertiesTabVisibilityChange(string gb_name) { GroupBox foundGrid = SomeUtilities.FindChild <GroupBox>(this, "gb_" + gb_name); if (foundGrid != null) { foundGrid.Visibility = System.Windows.Visibility.Visible; } if (gb_name == "base") { cb_extra_on_off.IsEnabled = false; } else { cb_extra_on_off.IsEnabled = true; } }
private void btn_setBackground_Click(object sender, RoutedEventArgs e) { string filename; filename = toolbox.currentView.background; if (filename == "") { return; } //if (this.Title.ToLower() == "system") // filename = ((App)Application.Current).backgroundImagePath; //else // filename = ((App)Application.Current).backgroundSystemImagePath; filename = SomeUtilities.MakeAbsolutePath(((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml", filename); if (!File.Exists(filename)) { return; } Image image = SomeUtilities.FindChild <Image>(canvas, "Backgroundimage"); if (image != null) { if (image.Visibility == System.Windows.Visibility.Visible) { image.Visibility = System.Windows.Visibility.Hidden; } else { image.Visibility = System.Windows.Visibility.Visible; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(filename); bitmap.EndInit(); //image = new Image(); image.Name = "Backgroundimage"; image.Source = bitmap; image.Width = canvas1.Width; image.Height = canvas1.Height; image.MouseDown += canvas1_MouseDown; //Panel.SetZIndex(image, 0); //canvas1.Children.Add(image); } } else { BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(filename); bitmap.EndInit(); image = new Image(); image.Name = "Backgroundimage"; image.Source = bitmap; image.Width = canvas1.Width; image.Height = canvas1.Height; image.MouseDown += canvas1_MouseDown; Panel.SetZIndex(image, 0); canvas1.Children.Add(image); } }
public void setCurrentView(View view) { currentView = view; //Turn on the manual switch mode CheckBox so that the program does not react to changing their states //Enable or disable CheckBox if they have already been marked previously for the selected view cbManualChangeState = true; uncheckAllCheckboxes(); CheckBox foundCheckBox; for (int i = 0; i < currentView.elements.Count; i++) { addCreatedelement(currentView.elements.Values[i].name); foundCheckBox = SomeUtilities.FindChild <CheckBox>(grid1, "cb_" + currentView.elements.Values[i].name); if (foundCheckBox != null) { foundCheckBox.IsChecked = true; } else { if (cb_CustomeItem.Items.IndexOf(currentView.elements.Values[i].name) < 0) { cb_CustomeItem.Items.Add(currentView.elements.Values[i].name); } } } //Turn off the manual switch mode CheckBox cbManualChangeState = false; switch (View.GetType(currentView.name)) { case View.types.system: c_system.Visibility = System.Windows.Visibility.Visible; if (!checCheckedCheckboxes(c_detailed)) { c_basic.Visibility = System.Windows.Visibility.Hidden; } if (!checCheckedCheckboxes(c_detailed)) { c_detailed.Visibility = System.Windows.Visibility.Hidden; } if (!checCheckedCheckboxes(c_video)) { c_video.Visibility = System.Windows.Visibility.Hidden; } break; case View.types.basic: c_basic.Visibility = System.Windows.Visibility.Visible; if (!checCheckedCheckboxes(c_detailed)) { c_detailed.Visibility = System.Windows.Visibility.Hidden; } if (!checCheckedCheckboxes(c_video)) { c_video.Visibility = System.Windows.Visibility.Hidden; } c_system.Visibility = System.Windows.Visibility.Hidden; break; case View.types.detailed: c_basic.Visibility = System.Windows.Visibility.Visible; c_detailed.Visibility = System.Windows.Visibility.Visible; if (!checCheckedCheckboxes(c_video)) { c_video.Visibility = System.Windows.Visibility.Hidden; } c_system.Visibility = System.Windows.Visibility.Hidden; break; case View.types.video: c_basic.Visibility = System.Windows.Visibility.Visible; c_detailed.Visibility = System.Windows.Visibility.Visible; c_video.Visibility = System.Windows.Visibility.Visible; c_system.Visibility = System.Windows.Visibility.Hidden; break; } }