/// ////////////////////////////////////////////////// /* 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) { } ////////////////////////// }
/// ////////////////////////////////////////////////// /* 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);*/ } ////////////////////////// }
public void Deter_Type(block_type type) { Block_Sprite.color = Block_Color[(int)type]; }