Пример #1
0
 public Button(Command command_,int selection_,int v_offset_px,int h_offset_px,int height_px,int width_px)
 {
     command = command_;
     selection = selection_;
     rect = new Rectangle(h_offset_px,v_offset_px,width_px,height_px);
     //drag_update = Move;
 }
Пример #2
0
 //public Func<Point,bool> clicked{ get{ return internal_clicked; } }
 //public Func<Point,Action<int,int>> on_drag{ get{ return internal_on_drag; } }
 public Button(Command command_,int v_offset_px,int h_offset_px,int height_px,int width_px)
 {
     //todo: allow different corners?
     command = command_;
     selection = -1;
     rect = new Rectangle(h_offset_px,v_offset_px,width_px,height_px);
     //drag_update = Move;
 }
Пример #3
0
        public void Run()
        {
            this.userInterface.WriteLine(Messages.Legend);
            string commandLine = this.userInterface.ReadLine();

            while (commandLine != "exit")
            {
                commandLine = commandLine.Trim();
                if (!string.IsNullOrEmpty(commandLine))
                {
                    try
                    {
                        var command = new Command(commandLine);
                        this.commandExecutor.ExecuteCommand(command, this.data);
                    }
                    catch (Exception ex)
                    {
                        this.userInterface.WriteLine(ex.Message);
                    }
                }

                commandLine = this.userInterface.ReadLine();
            }
        }
Пример #4
0
 /// <summary>
 /// Run 'commandLine' as a subprocess and waits for the command to complete.
 /// Output is captured and placed in the 'Output' property of the returned Command 
 /// structure. 
 /// </summary>
 /// <param variable="commandLine">The command lineNumber to run as a subprocess</param>
 /// <param variable="options">Additional qualifiers that control how the process is run</param>
 /// <returns>A Command structure that can be queried to determine ExitCode, Output, etc.</returns>
 public static Command Run(string commandLine, CommandOptions options)
 {
     Command run = new Command(commandLine, options);
     run.Wait();
     return run;
 }
Пример #5
0
 public ButtonImage GetFittedButton(int start_row,int start_col,int height_in_cells,int width_in_cells,Command command,int selection = -1)
 {
     //helper method to create a button based on cells.
     return new ButtonImage(command,selection,surface.TotalYOffsetPx() + start_row*cell_h,surface.TotalXOffsetPx() + start_col*cell_w,height_in_cells*cell_h,width_in_cells*cell_w,surface);
     //return new Button(command,selection,surface.TotalYOffsetPx() + start_row*cell_h,surface.TotalXOffsetPx() + start_col*cell_w,height_in_cells*cell_h,width_in_cells*cell_w);
 }
Пример #6
0
 public void ButtonWrite(int row,int col,string s,Color4 color,Color4 bgcolor,Command command,int selection = -1)
 {
     Write(row,col,s,color,bgcolor);
     if(buttons[row,col] == null){
         int sel = selection;
         if(sel == -1){
             sel = row;
         }
         Button b = new Button(command,sel,surface.TotalYOffsetPx() + row*cell_h,surface.TotalXOffsetPx() + col*cell_w,cell_h,s.Length*cell_w);
         for(int j=col;j<col+s.Length;++j){
             buttons[row,j] = b;
         }
         internal_main_button.AddButton(b);
     }
 }
Пример #7
0
 public void ButtonWrite(int row,int col,string s,Color4 color,Command command,int selection = -1)
 {
     ButtonWrite(row,col,s,color,colorchar.DefaultBackgroundColor,command,selection);
 }
Пример #8
0
 //todo: ButtonAdd and ButtonRemove, for non-printing tasks?
 public void ButtonWrite(int row,int col,string s,Command command,int selection = -1)
 {
     //if there's already a button here, no new button will be created.
     ButtonWrite(row,col,s,colorchar.DefaultColor,colorchar.DefaultBackgroundColor,command,selection);
 }
Пример #9
0
 public ButtonImage(Command command_,int selection_,int v_offset_px,int h_offset_px,int height_px,int width_px,params Surface[] surfaces_)
     : base(command_,selection_,v_offset_px,h_offset_px,height_px,width_px)
 {
     surfaces = new List<Surface>(surfaces_); //todo: this needs a better constructor. Maybe it should find the layout and use its size.
 }
Пример #10
0
 public static int RotatedDirectionFromInput(Command command)
 {
     switch(command){
     case Command.Up:
     return 8.RotateFourWayDir(false,M.Rotation);
     case Command.Down:
     return 2.RotateFourWayDir(false,M.Rotation);
     case Command.Left:
     return 4.RotateFourWayDir(false,M.Rotation);
     case Command.Right:
     default:
     return 6.RotateFourWayDir(false,M.Rotation);
     }
 }