public void GetControls() { for (int i = 0; i < canvas.Children.Count; i++) { if (((FrameworkElement)canvas.Children[i]).Tag == null || ((FrameworkElement)canvas.Children[i]).Tag.ToString() != "!S!") { StackPanel item = new StackPanel(); item.Tag = i; Label lab = new Label() { Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[i]).Name) + "] " + ControlNameWorker.GetTypeName(canvas.Children[i], out txt) }; item.Children.Add(lab); ListControls.Items.Add(item); if (OBJSelected != null) { Debug.WriteLine("" + OBJSelected); if (OBJSelected == canvas.Children[i]) { ListControls.SelectedIndex = i; Sel_Label.Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[i]).Name) + "] " + ControlNameWorker.GetTypeName(canvas.Children[i], out txt); SelectedI = i; } } } } }
private void CB_Type_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (AnimationSettings != null) { CB_Type.IsEnabled = true; if (CB_Type.SelectedIndex == 0) { AnimationSettings.Content = null; Anim_Position anim_Position = new Anim_Position(ControlWorker.GetID(((FrameworkElement)canvas.Children[SelectedI]).Name), Canvas.GetLeft(canvas.Children[SelectedI]), Canvas.GetTop(canvas.Children[SelectedI])); anim_Position.AddAnimation += Anim_Position_AddAnimation; AnimationSettings.Content = anim_Position; } else if (CB_Type.SelectedIndex == 1) { AnimationSettings.Content = null; Anim_Opacity anim_Position = new Anim_Opacity(ControlWorker.GetID(((FrameworkElement)canvas.Children[SelectedI]).Name), canvas.Children[SelectedI].Opacity); anim_Position.AddAnimation += Anim_Position_AddAnimation; AnimationSettings.Content = anim_Position; } else { AnimationSettings.Content = null; Anim_Size anim_Position = new Anim_Size(ControlWorker.GetID(((FrameworkElement)canvas.Children[SelectedI]).Name), ((FrameworkElement)canvas.Children[SelectedI]).Width, ((FrameworkElement)canvas.Children[SelectedI]).Height); anim_Position.AddAnimation += Anim_Position_AddAnimation; AnimationSettings.Content = anim_Position; } } }
public void LoadData() { Box_W.Text = "" + cont.Width; Box_H.Text = "" + cont.Height; Box_X.Text = "" + +(double)cont.GetValue(Canvas.LeftProperty); Box_Y.Text = "" + (double)cont.GetValue(Canvas.TopProperty); Box_Z.Text = "" + Panel.GetZIndex(cont); Run_ID.Text = "" + ControlWorker.GetID(cont.Name); ComboBox_SizeUnits.SelectedIndex = MainWindow.CUnit; }
public Window_ControlsID(Canvas canvas) { InitializeComponent(); string prp; for (int i = 0; i < canvas.Children.Count; i++) { SP_ControlsID.Children.Add(new Label() { Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[i]).Name) + "] - " + ControlNameWorker.GetTypeName(canvas.Children[i], out prp) }); } }
private void ListControls_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListControls.SelectedIndex >= 0) { StackPanel stc = ((StackPanel)ListControls.SelectedItem); int iC = int.Parse(stc.Tag.ToString()); if (ClickControl != null) { ClickControl(canvas.Children[iC]); } Sel_Label.Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[iC]).Name) + "] " + ControlNameWorker.GetTypeName(canvas.Children[iC], out txt); SelectedI = iC; CB_Type_SelectionChanged(null, null); AnimPanel.SelectedIndex = -1; } }
public void SaveControlState() { output.Pages[currentLoaded].InputList.Clear(); foreach (FrameworkElement elm in PlayCanvas.Children) { if (elm is TextBox) { output.Pages[currentLoaded].InputList.Add(new TextboxInput(elm.Tag.ToString(), ((TextBox)elm).Text)); } else if (elm is CheckBox) { output.Pages[currentLoaded].InputList.Add(new CheckBoxInput(((CheckBox)elm).Content?.ToString(), ((CheckBox)elm).IsChecked == true)); } else if (elm is RadioButton) { output.Pages[currentLoaded].InputList.Add(new RadioButtonInput(((RadioButton)elm).Content?.ToString(), ((RadioButton)elm).IsChecked == true, ((RadioButton)elm).GroupName)); } else if (elm is ToggleButton_Control) { string checkSTR = ""; if (((ToggleButton_Control)elm).IsChecked) { checkSTR = ((ToggleButton_Control)elm).contentCreatorChecked.GetText(); } else { checkSTR = ((ToggleButton_Control)elm).contentCreatorUnchecked.GetText(); } output.Pages[currentLoaded].InputList.Add(new ToggleButtonInput("" + ControlWorker.GetID(((ToggleButton_Control)elm).Name), checkSTR, ((ToggleButton_Control)elm).IsChecked)); } } }
public Window_AllControls(Canvas canvas, string Text) { InitializeComponent(); Title += " - " + Text; int i = 0; foreach (FrameworkElement elem in canvas.Children) { if (elem.Tag == null || elem.Tag.ToString() != "!S!") { MenuItem item = new MenuItem(); StackPanel panel = new StackPanel(); Label lab = new Label(); lab.Content = ControlNameWorker.GetTypeName(elem, out property); lab.FontWeight = FontWeights.Bold; Label lab2 = new Label(); lab2.Content = "X: " + elem.GetValue(Canvas.LeftProperty) + " Y: " + elem.GetValue(Canvas.TopProperty) + " Z: " + Panel.GetZIndex(elem) + " " + Strings.ResStrings.ID + ": " + ControlWorker.GetID(elem.Name) + " " + property; panel.Children.Add(lab); panel.Children.Add(lab2); panel.Orientation = Orientation.Horizontal; item.Header = panel; item.Click += Item_Click; item.Tag = elem; Menu_list.Items.Add(item); i++; } } property = ""; }