• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.Command类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.Command的典型用法代码示例。如果您正苦于以下问题:C# Command类的具体用法?C# Command怎么用?C# Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Command类属于System.Windows.Forms命名空间,在下文中一共展示了Command类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnExecute

        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            double lengthConversion = ActiveWindow.Units.Length.ConversionFactor;

            bool isImperial = Booleans[Resources.IsImperial].Value;
            bool isInternal = Booleans[Resources.ThreadIsInternal].Value;

            double pitch = isImperial ? (Const.inches / Values[Resources.ThreadPitch].Value) : (1E-3 * Values[Resources.ThreadPitch].Value);
            double angle = Values[Resources.ThreadAngle].Value * Math.PI / 180;

            Body[] bodies = SpaceClaimExtensions.GetAllSelectedIDesignFaces(Window.ActiveWindow)
                .Where(f => f.Shape.Geometry is Cylinder)
                .Select(f => f.Master.Parent.Shape.CopyFaces(new[] { f.Master.Shape }))
                .Select(b => b.Faces.First())
                .Select(f => CreateThreads(f, pitch, angle, isInternal))
                .ToArray();

            Part part = Window.ActiveWindow.Scene as Part;
            foreach (Body body in bodies)
                DesignBody.Create(part, Resources.ThreadStructureText, body);

            Settings.Default.IsImperial = isImperial;
            Settings.Default.IsInternal = isInternal;
            Settings.Default.Pitch = isImperial ? 0.0254 / pitch : pitch / 1E3;
            Settings.Default.Angle = angle * 180 / Math.PI;

            Settings.Default.Save();
        }
开发者ID:bcourter,项目名称:SpaceClaim-AddIns,代码行数:28,代码来源:UtilitiesRibbon.cs


示例2: Parse

            // Command cmd = Command.Parse("1,a->b,R/L/N,0");
            public static Command Parse(string commandString)
            {
                Command command = new Command();

                if (commandString == null)
                {
                    throw new ArgumentNullException("commandString");
                }

                string[] commandParts = commandString.Split(new string[] { "->" }, StringSplitOptions.RemoveEmptyEntries);

                if (commandParts.Length < 2)
                {
                    throw new FormatException("Invalid command string format. Command parts separator not found.");
                }

                string[] leftParams = commandParts[0].Split(',');

                if (leftParams.Length < 2)
                {
                    throw new FormatException("Invalid command string format. Missing some command's left part parameters.");
                }

                string[] rightParams = commandParts[1].Split(',');

                if (rightParams.Length < 3)
                {
                    throw new FormatException("Invalid command string format. Missing some command's right part parameters.");
                }

                try
                {
                    command.InitialState = int.Parse(leftParams[0]);
                    command.InitialValue = char.Parse(leftParams[1]);

                    command.FinalValue = char.Parse(rightParams[0]);
                    command.FinalState = int.Parse(rightParams[2]);

                    switch (char.Parse(rightParams[1]))
                    {
                        case 'R':
                            command.Move = Directions.Right;
                            break;
                        case 'L':
                            command.Move = Directions.Left;
                            break;
                        case 'N':
                            command.Move = Directions.NoMotion;
                            break;
                        default:
                            throw new FormatException("Invalid command string format. Invalid direction.");
                    }
                }
                catch (Exception e)
                {
                    throw new FormatException("Invalid command string format.", e);
                }

                return command;
            }
开发者ID:kotlerman,项目名称:TuringMachineEmulator,代码行数:61,代码来源:TuringMachine.cs


示例3: OnExecute

        protected override void OnExecute(Command command, System.Drawing.Rectangle buttonRect)
        {
            base.OnExecute(command, buttonRect);

            foreach (Point point in controlForm.CalibrationPoints) {
                DesignBody desBody = ShapeHelper.CreateSphere(point, 0.1, part);
                desBody.Layer = referenceLayer;
            }

            foreach (VideoForm videoForm in controlForm.VideoForms) {
                Point point = videoForm.TrackingCamera.GetLine(PointUV.Origin).Evaluate(0.2).Point;
                DesignBody desBody = ShapeHelper.CreateSphere(point, 0.1, part);
                desBody.Layer = referenceLayer;

                foreach (PointUV pointUV in videoForm.TrackingCamera.CalibrationPoints) {
                    point = videoForm.TrackingCamera.GetLine(pointUV).Evaluate(0.2).Point;
                    //desBody = ShapeHelper.CreateSphere(point, 0.1, part);
                    //desBody.Layer = referenceLayer;
                    var desCurve = DesignCurve.Create(part, CurveSegment.Create(PointCurve.Create(point)));
                    desCurve.Layer = referenceLayer;
                }

                for (int i = 0; i < videoForm.Size.Width; i += videoForm.Size.Width / 12) {
                    for (int j = 0; j < videoForm.Size.Height; j += videoForm.Size.Height / 12) {
                        Line line = videoForm.TrackingCamera.GetLine(PointUV.Create(i, j));
                        var curveSegment = CurveSegment.Create(line, Interval.Create(-3, 6));
                        var desCurve = DesignCurve.Create(part, curveSegment);
                        desCurve.Layer = referenceLayer;
                    }
                }
            }
        }
开发者ID:bcourter,项目名称:SpaceClaim-Addins-Experimental,代码行数:32,代码来源:Tracker.cs


示例4: AddCommand

 private bool AddCommand(Command c)
 {
     if (c == null)
     {
         DebugLog("WARNING: Cannot use NULL command");
         return false;
     }
     string cName = c.Name;
     if (string.IsNullOrEmpty(cName))
     {
         DebugLog("WARNING: Cannot use no-name command " + c.GetType());
         return false;
     }
     if (cName.StartsWith("!"))
     {
         //DebugLog("WARNING: Skipping command " + cName);
         return false;
     }
     if (c.Parameters == null)
     {
         // DebugLog("WARNING: Skipping non-paramerized command " + cName);
         return false;
     }
     int i = 0;
     while (i < c.Parameters.Parameters.Length)
     {
         Type from = (Type)c.Parameters.Parameters[i].SourceType;
         Type use = (Type)c.Parameters.Parameters[i].DestinationType;
         AddCommand(c, from, use);
         i++;
     }
     return true;
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:33,代码来源:CommandContextAction.cs


示例5: AddCommand

 public void AddCommand(string commandName, Command cmd)
 {
     Button item = new Button();
     item.Text = commandName;
     item.Click += delegate {  cmd(); };
     theAmazingLayout.Controls.Add(item);
 }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:7,代码来源:WinFormGenericUserInterface.cs


示例6: ButtonCommandBinding

 public ButtonCommandBinding(Button button, Command command)
 {
     button.Click += (o, e) =>
     {
         command.run();
     };
 }
开发者ID:josephvano,项目名称:nbdn_2009_august_orlando,代码行数:7,代码来源:ButtonCommandBinding.cs


示例7: OnExecute

        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            sweepAngle = Values[Resources.LenticularSweepAngle].Value * Math.PI / 180;
            interlaceCount = (int) Values[Resources.LenticularInterlaceCount].Value;
            interlaceWidth = (int) Values[Resources.LenticularInterlaceWidth].Value;

            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = "PNG Files (*.png)|*.png";
            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
                return;

            fileName = dialog.FileName;

            activeWindow = Window.ActiveWindow;
            originalWindowTrans = activeWindow.Projection;
            screenY = Line.Create(Point.Origin, originalWindowTrans.Inverse * Direction.DirY);

            string file = GetEnumeratedFileName(0);
            activeWindow.Export(WindowExportFormat.Png, file);
            Bitmap bitmap = (Bitmap) Bitmap.FromFile(file);

            width = bitmap.Width;
            height = bitmap.Height;
        }
开发者ID:bcourter,项目名称:SpaceClaim-Addins-Experimental,代码行数:26,代码来源:Lenticular.cs


示例8: CommitEditCommand

        protected void CommitEditCommand()
        {
            try {
                if (incomingCommandTextBox.Text.Length == 0)
                    throw new Exception("Please enter an Incoming Command.");

                if (_controller.Commands.Where(i => i.Key == incomingCommandTextBox.Text).Count() > 0)
                    throw new DuplicateNameException("There already exists a Command with that Incoming Command. Choose a different string.");

                if (!File.Exists(targetTextBox.Text))
                    throw new FileNotFoundException("The Target cannot be found.");

                Command command = new Command
                {
                    IncomingCommand = incomingCommandTextBox.Text,
                    Target = targetTextBox.Text,
                    Arguments = argumentsTextBox.Text,
                    StartInDirectory = startInTextBox.Text
                };

                _controller.Commands.Add(command);

                LoadCommandsListView();
                DisableEditCommand();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
开发者ID:daniel-white,项目名称:SerialPortControl,代码行数:30,代码来源:MainForm.cs


示例9: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     var c = new Command();
     toReturn.Add(c);
     prpInCreation.SelectedObject = toReturn.Last();
     CommandList();
 }
开发者ID:Hook25,项目名称:DodoCompiler,代码行数:7,代码来源:FactoryElaborator.cs


示例10: OnExecute

        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            double surfaceDeviation = Values[Resources.TesselateSurfaceDeviationText].Value / ActiveWindow.Units.Length.ConversionFactor;
            double angleDeviation = Values[Resources.TesselateAngleDeviationText].Value / ActiveWindow.Units.Angle.ConversionFactor;

            ICollection<Face> faces = null;
            IDesignBody iDesignBody = Window.ActiveWindow.ActiveContext.SingleSelection as IDesignBody;
            if (iDesignBody != null)
                faces = (iDesignBody.Master.Shape as Body).Faces;
            else {
                ICollection<IDesignFace> iDesignFaces = Window.ActiveWindow.ActiveContext.GetSelection<IDesignFace>();
                foreach (IDesignFace iDesignFace in iDesignFaces) {
                    iDesignBody = iDesignFace.GetAncestor<DesignBody>();
                    continue; // TBD: handle multiple selection of faces across different DesignBodies
                }

                if (iDesignBody != null) {
                    List<Face> modelerFaces = new List<Face>();
                    foreach (DesignFace designFace in iDesignFaces) {
                        if (designFace.GetAncestor<DesignBody>() == iDesignBody)
                            modelerFaces.Add(designFace.Shape as Face);
                    }
                    if (modelerFaces.Count > 0)
                        faces = modelerFaces;
                }
                else
                    return;
            }

            iDesignBody.SetVisibility(null, false);
            Body body = iDesignBody.Shape as Body;

            IDictionary<Face, FaceTessellation> tessellationMap = body.GetTessellation(faces, FacetSense.RightHanded, new TessellationOptions(surfaceDeviation, angleDeviation));

            Body testfacetBody = null;
            List<Body> facetBodies = new List<Body>();
            Point[] points = new Point[3];

            foreach (FaceTessellation faceTessellation in tessellationMap.Values) {
                IList<FacetVertex> vertices = faceTessellation.Vertices;
                foreach (FacetStrip facetStrip in faceTessellation.FacetStrips) {
                    foreach (Facet facet in facetStrip.Facets) {
                        points[0] = vertices[facet.Vertex0].Position;
                        points[1] = vertices[facet.Vertex1].Position;
                        points[2] = vertices[facet.Vertex2].Position;

                        testfacetBody = ShapeHelper.CreatePolygon(points, null, 0);
                        if (testfacetBody != null)
                            facetBodies.Add(testfacetBody);
                    }
                }
            }

            // when the topology has holes (e.g. an annulus made with one surface), non-manifold vertices can occur when merging triangles around the hole.  The workaround is to merge the fragment lumps.
            facetBodies = new List<Body>(facetBodies.TryUnionBodies());
            facetBodies = new List<Body>(facetBodies.TryUnionBodies());
            foreach (Body facetBody in facetBodies)
                DesignBody.Create(iDesignBody.GetAncestor<Part>(), "Tesselation", facetBody);
        }
开发者ID:bcourter,项目名称:SpaceClaim-AddIns,代码行数:59,代码来源:Tessellate.cs


示例11: UnicornConnectionViewModel

 public UnicornConnectionViewModel(UnicornConnection connection)
 {
     _connection = connection;
     TestConnection = new Command(ExecuteTestConnection, () => !ShowProgressBar);
     Save = new Command(ExecuteSave, () => !ShowProgressBar);
     Install = new Command(ExecuteInstall, () => !ShowProgressBar);
     DownloadPackage = new Command(ExecuteDownloadPackage, () => !ShowProgressBar);
 }
开发者ID:BerserkerDotNet,项目名称:Unicorn.VisualStudio,代码行数:8,代码来源:UnicornConnectionViewModel.cs


示例12: CategoryItem

        public CategoryItem(string name, string description, Command command) 
            : this(name, description)
        {
            if (command == null) 
                throw new ArgumentNullException("command");

            control = new CategoryItemCommandControl(this, command);
        }
开发者ID:tomasdeml,项目名称:hyphen,代码行数:8,代码来源:CategoryItem.cs


示例13: btn_Accept_Click

        private void btn_Accept_Click(object sender, EventArgs e)
        {
            //using client controller to save the new Command into the db

            clientController.insertCommandIntoDb(command);
            command = null;
            this.Close();
        }
开发者ID:Zoltan21,项目名称:Csharp,代码行数:8,代码来源:ReportCommand.cs


示例14: ReportCommand

        public ReportCommand(Command command, ClientController clientController)
        {
            InitializeComponent();
            this.command = command;
            this.clientController = clientController;

            init(command);
        }
开发者ID:Zoltan21,项目名称:Csharp,代码行数:8,代码来源:ReportCommand.cs


示例15: AssignID

        protected static void AssignID(Command cmd) {
            lock(internalSyncObject) {
                int icmd;

                if (null == cmds) {
                    cmds = new Command[20];
                    icmd = 0;
                }
                else {
                    Debug.Assert(cmds.Length > 0, "why is cmds.Length zero?");
                    Debug.Assert(icmdTry >= 0, "why is icmdTry negative?");

                    int icmdLim = cmds.Length;

                    if (icmdTry >= icmdLim)
                        icmdTry = 0;

                    // First look for an empty slot (starting at icmdTry).
                    for (icmd = icmdTry; icmd < icmdLim; icmd++)
                        if (null == cmds[icmd]) goto FindSlotComplete;
                    for (icmd = 0; icmd < icmdTry; icmd++)
                        if (null == cmds[icmd]) goto FindSlotComplete;

                    // All slots have Command objects in them. Look for a command
                    // with a null referent.
                    for (icmd = 0; icmd < icmdLim; icmd++)
                        if (null == cmds[icmd].Target) goto FindSlotComplete;

                    // Grow the array.
                    icmd = cmds.Length;
                    icmdLim = Math.Min(idLim - idMin, 2 * icmd);

                    if (icmdLim <= icmd) {
                        // Already at maximal size. Do a garbage collect and look again.
                        GC.Collect();
                        for (icmd = 0; icmd < icmdLim; icmd++) {
                            if (null == cmds[icmd] || null == cmds[icmd].Target)
                                goto FindSlotComplete;
                        }
                        throw new ArgumentException(SR.GetString(SR.CommandIdNotAllocated));
                    }
                    else {
                        Command[] newCmds = new Command[icmdLim];
                        Array.Copy(cmds, 0, newCmds, 0, icmd);
                        cmds = newCmds;
                    }
                }

FindSlotComplete:

                cmd.id = icmd + idMin;
                Debug.Assert(cmd.id >= idMin && cmd.id < idLim, "generated command id out of range");

                cmds[icmd] = cmd;
                icmdTry = icmd + 1;
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:57,代码来源:Command.cs


示例16: AddCommand

    /// <summary>
    /// Adds the command.
    /// </summary>
    /// <param name="identifier">The identifier.</param>
    /// <param name="text">The text to appear as the command's text.</param>
    /// <param name="eventHandler">The event handler.</param>
    private void AddCommand(string identifier, string text, EventHandler eventHandler)
    {
      ICommandBar commandBar = this.commandBarManager.CommandBars[identifier];

      Command command = new Command();
      command.CommandBar = identifier;
      command.Separator = commandBar.Items.AddSeparator();
      command.Button = commandBar.Items.AddButton(text, eventHandler);
      this.commands.Add(command);
    }
开发者ID:WrongDog,项目名称:Sequence,代码行数:16,代码来源:OpenSequencePackage.cs


示例17: add_child

 public ITreeBranch add_child(string name, ApplicationIcon icon, Command command)
 {
     var new_node = new TreeNode(name)
                        {
                            ImageKey = icon.name_of_the_icon,
                            SelectedImageKey = icon.name_of_the_icon
                        };
     node.Nodes.Add(new_node);
     return new TreeBranch(new_node, command);
 }
开发者ID:mokhan,项目名称:mo.money,代码行数:10,代码来源:TreeBranch.cs


示例18: ParseCommand

 private void ParseCommand(Command header, object[] @params)
 {
     switch (header)
     {
         case Command.Message:
             string text = (string)@params[1];
             //Casting params(1) to typeof string
             HandleMessagePacket(text);
             break;
     }
 }
开发者ID:ShockwaveHF,项目名称:Imminent-Monitor-Plugin-Base,代码行数:11,代码来源:Main.cs


示例19: init

 private void init(Command command)
 {
     txtFromCity.Text = clientController.getCityName(command.StartCityId);
     txtToCity.Text = clientController.getCityName(command.DestCityId);
     txtKgPerPallet.Text = command.Ware.WeightPerPallet.ToString();
     txtNrOfPallets.Text = command.Ware.NrOfPallets.ToString();
     txtDescription.Text = command.Ware.Description;
     txtPickUpDate.Text = command.StartTime.ToString();
     txtDeliveryDate.Text = DateTime.Today.AddDays(4).ToString();// excepting the worst case
     txtPrice.Text = command.CommandPrice.ToString();
 }
开发者ID:Zoltan21,项目名称:Csharp,代码行数:11,代码来源:ReportCommand.cs


示例20: AddCommand

        /// <summary>
        /// Adds the specified command.
        /// </summary>
        /// <param name="command">The command to add.</param>
        public void AddCommand(Command command)
        {
            //	Ensure that this is not a duplicate.  In debug mode, assert that this is true.
            //	In release mode, fail silently (replacing the existing command) so as not to take
            //	down a running system.
            Debug.Assert(!commandTable.Contains(command.Identifier), "Duplicate command encountered.", String.Format("Command {0} already exists.", command.Identifier));

            //	Add the command to the command table.
            commandTable[command.Identifier] = command;

            //	Add the shortcut for the command to the shortcut table.
            AddShortcut(command);
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:17,代码来源:CommandTable.cs



注:本文中的System.Windows.Forms.Command类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.CommandBarButton类代码示例发布时间:2022-05-26
下一篇:
C# Forms.ComboBox类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap