/* CONSTRUCTOR */ /// ///////////////////////////////////////////////////////////////////////////// /* BLOCK FUNCTIONS */ //Move feature function, used for moving blocks, called by main move timer public void Move() { if (is_movable == true) { Point mouse_loc = Mouse.GetPosition(Application.Current.MainWindow); Thickness group_loc = canvas.Margin; if (mouse_loc.X > 0 && mouse_loc.Y > 0) { group_loc.Left = ((int)(mouse_loc.X / 5)) * 5 - 30; group_loc.Top = ((int)(mouse_loc.Y / 5)) * 5 - 20; } canvas.Margin = group_loc; Point p; Fabricator.FindConnectionPoint(canvas.Margin, out p); Main_X = p.X; Main_Y = p.Y; Render(Main_X, Main_Y); } }
/// <summary> /// Block constructor, the most important place in the whole code: decodes what features are needed in a block. /// </summary> /// public Read_all_lines(string input) : base(input, block_type.Input) { File_button = Fabricator.Create_Button(info.File_info); canvas.Children.Add(File_button); File_button.Click += new RoutedEventHandler(File_button_click); file = new DataProcessing.Input.File(); output_io = new output_sockiet(this, info.Output_info); canvas.Children.Add(output_io.button); }
public RS_232_output(string input) : base(input, block_type.Output) { Block_info set_buttton_info = info.File_info; set_buttton_info.name = "Settings"; setting_button = Fabricator.Create_Button(set_buttton_info); setting_button.Click += new RoutedEventHandler(Setting_button_click); canvas.Children.Add(setting_button); funct_ref = new input_sockiet.parent_function(Input_function); input_io = new input_sockiet(this, info.Input_info, ref funct_ref); canvas.Children.Add(input_io.button); }
/// ////////////////////////////////////////////////// /* CONSTRUCTOR */ public Basic_block(string input_name, block_type b_type) { name = input_name; info = new Info(); canvas = new Canvas(); canvas.VerticalAlignment = VerticalAlignment.Top; canvas.HorizontalAlignment = HorizontalAlignment.Left; canvas.Width = 100; canvas.Height = 100; MainGrid_ref.Children.Add(canvas); Move_button = Fabricator.Create_Button(info.Move_info); Move_button.Click += new RoutedEventHandler(Move_button_click); canvas.Children.Add(Move_button); Delete_button = Fabricator.Create_Button(info.Delete_info); Delete_button.Click += new RoutedEventHandler(Delete_button_click); canvas.Children.Add(Delete_button); if (b_type == block_type.Input) { Read_button = Fabricator.Create_Button(info.Read_info); canvas.Children.Add(Read_button); Read_button.Click += new RoutedEventHandler(Read_button_click); } if (b_type == block_type.Output || b_type == block_type.Processing || b_type == block_type.Flow) { } if (b_type == block_type.Input || b_type == block_type.Processing || b_type == block_type.Flow) { } ////////////////////////// }
public Button create_button(Block_info position) { button = Fabricator.Create_Button(position); button.Click += new RoutedEventHandler(In_sockiet_click); return(button); }
/// ////////////////////////////////////////////////// /* CONSTRUCTOR */ ///Construction -> this is where we create canvas, basic move, delete butttons and initilate misc things for special features public Basic_block(string input_name, block_type b_type) { name = input_name; info = new Info();//I HATE IT i don't wanna to initialisate it :( groupBox = Fabricator.Create_GroupBox(100, 100, 100, 150, "Block"); MainGrid_ref.Children.Add(groupBox); canvas = new Canvas(); canvas.VerticalAlignment = VerticalAlignment.Top; canvas.HorizontalAlignment = HorizontalAlignment.Left; canvas.Width = 100; canvas.Height = 100; groupBox.Content = canvas; //Ahhh nice and readable button constructors :) Move_button = Fabricator.Create_Button(info.Move_info); Move_button.Click += new RoutedEventHandler(Move_button_click); canvas.Children.Add(Move_button); Delete_button = Fabricator.Create_Button(info.Delete_info); Delete_button.Click += new RoutedEventHandler(Delete_button_click); canvas.Children.Add(Delete_button); ////////////////////////// /*Obsolete section! Used previously to show read, write and pick input,output buttons, everything in hadndled by ioblocks now, it's obsolete now*/ // need to be replaced with better button api if (b_type == block_type.Input) { //Read_button = Fabricator.Create_Button(5, 70, 50, 20, "Read"); Read_button = Fabricator.Create_Button(info.Read_info); canvas.Children.Add(Read_button); Read_button.Click += new RoutedEventHandler(Read_button_click); } if (b_type == block_type.Output || b_type == block_type.Processing || b_type == block_type.Flow) { //Pick_input_button = Fabricator.Create_Button(5, 95, 50, 20, "Pick input"); /* * Pick_input_button = Fabricator.Create_Button(info.Input_info); * canvas.Children.Add(Pick_input_button); * Pick_input_button.Click += new RoutedEventHandler(Pick_input_button_click); */ } if (b_type == block_type.Input || b_type == block_type.Processing || b_type == block_type.Flow) { //Pick_output_button = Fabricator.Create_Button(5, 125, 50, 20, "Pick output"); /* * Pick_output_button = Fabricator.Create_Button(info.Output_info); * canvas.Children.Add(Pick_output_button); * Pick_output_button.Click += new RoutedEventHandler(Pick_output_button_click);*/ } ////////////////////////// }