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 static T MakeControlWithLabel <T>(GUIContent label, ControlWorker <T> worker) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(label); var result = worker(); EditorGUILayout.EndHorizontal(); return(result); }
void MakeAnimation(int pos, int ID) { if (ID >= 0 && ID < data.pages[pos].AnimationList.Count) { FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + data.pages[pos].AnimationList[ID].GetID()); if (felm != null) { data.pages[pos].AnimationList[ID].MakeAnimation(felm); } } }
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) }); } }
void MakeAnimations(int pos) { foreach (IAnimation ian in data.pages[pos].AnimationList) { FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + ian.GetID()); if (felm != null) { if (ian.DoAnimationAtStart()) { ian.MakeAnimation(felm); } } } }
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 DoAction(IActions action) { int act = action.DoAction(); switch (act) { case 1: if (((Action_GoToPage)action).ToSpecific) { LoadCanvas(((Action_GoToPage)action).ToPage - 1, true); UpdateNumberLabel(); } else if (((Action_GoToPage)action).Next) { GoForward(); } else { GoBack(); } break; case 2: Close(); break; case 3: if (((Action_Sound)action).Stop) { mediaplayer.Stop(); } else if (((Action_Sound)action).PlayAgain) { mediaplayer.Position = TimeSpan.Zero; mediaplayer.Play(); } else { if (!String.IsNullOrWhiteSpace(((Action_Sound)action).PathToPlay)) { SetSoundToBePlayed(((Action_Sound)action).PathToPlay, ((Action_Sound)action).Repeat); } } break; case 4: LoadNewPresentation(((Action_LoadPresentation)action).PresentationPath); break; case 5: { FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + ((Action_SetVisibility)action).ID); if (felm != null) { if (((Action_SetVisibility)action).VisibilityValue == SetVisibilityEnum.SetVisibilityValue.SetToVisible) { felm.Visibility = Visibility.Visible; } else if (((Action_SetVisibility)action).VisibilityValue == SetVisibilityEnum.SetVisibilityValue.SetToInvisible) { felm.Visibility = Visibility.Collapsed; } else { if (felm.Visibility == Visibility.Collapsed || felm.Visibility == Visibility.Hidden) { felm.Visibility = Visibility.Visible; } else { felm.Visibility = Visibility.Collapsed; } } } break; } case 6: MakeAnimation(currentLoaded, ((Action_DoAnimation)action).AnimationID); break; case 7: { FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(PlayCanvas, "ID_" + ((Action_Position)action).ID); if (felm != null) { if (((Action_Position)action).ChangeX) { MathSignEnum.SetPositionX(((Action_Position)action).CX, ((Action_Position)action).SignX, felm); } if (((Action_Position)action).ChangeY) { MathSignEnum.SetPositionY(((Action_Position)action).CY, ((Action_Position)action).SignY, felm); } } break; } } }
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)); } } }
void RefreshAnimList() { if (Pid >= 0) { AnimPanel.Items.Clear(); int k = 0; List <IAnimation> Removelist = new List <IAnimation>(); foreach (IAnimation ian in data.pages[Pid].AnimationList) { FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(canvas, "ID_" + ian.GetID()); if (felm != null) { StackPanel stc = new StackPanel(); stc.Orientation = Orientation.Horizontal; /* * if ((k % 2) == 0) * stc.Background = new SolidColorBrush(Color.FromRgb(189, 195, 199)); * else * stc.Background = new SolidColorBrush(Color.FromRgb(236, 240, 241)); */ Label lbl = new Label(); lbl.Content = (k + 1) + ". [" + ian.GetID() + "] " + ControlNameWorker.GetTypeName(felm, out txt); Image img = new Image(); if (ian is Animation_Position) { img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Animations/OpacityAnimation.png")); } else if (ian is Animation_Size) { img.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Animations/Scale.png")); } img.Width = 32; img.Height = 32; stc.Children.Add(img); stc.Children.Add(lbl); //stc.MouseLeftButtonDown += Stc_MouseLeftButtonDown; stc.Tag = ian; AnimPanel.Items.Add(stc); k++; } else { Removelist.Add(ian); } } foreach (IAnimation ian in Removelist) { data.pages[Pid].AnimationList.Remove(ian); } } }
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 = ""; }