コード例 #1
0
ファイル: DNAEngine.cs プロジェクト: trichards57/ALife
        private void ExecuteBooleanCommand(BooleanCommand command)
        {
            bool a, b;

            switch (command)
            {
            case BooleanCommand.And:
                b = BoolStack.Pop();
                a = BoolStack.Pop();
                BoolStack.Push(a & b);
                break;

            case BooleanCommand.Or:
                b = BoolStack.Pop();
                a = BoolStack.Pop();
                BoolStack.Push(a | b);
                break;

            case BooleanCommand.Xor:
                b = BoolStack.Pop();
                a = BoolStack.Pop();
                BoolStack.Push(a ^ b);
                break;
            }
        }
コード例 #2
0
ファイル: ImportManager.cs プロジェクト: radtek/Shopdrawing
        public void SimplifyPathData(ref System.Windows.Media.Geometry geometry)
        {
            PathGeometry geometry1 = geometry as PathGeometry;

            BooleanCommand.CleanUpPathGeometry(ref geometry1);
            PathGeometry geometry2 = PathConversionHelper.RemoveDegeneratePoints((System.Windows.Media.Geometry)geometry1);

            PathGeometryUtilities.CollapseSingleSegmentsToPolySegments(geometry2);
            PathCommandHelper.GrokPathPointPrecision(geometry2, 3);
            geometry = (System.Windows.Media.Geometry)geometry2;
        }
コード例 #3
0
                protected override void OnLoadComplete(EventArgs e)
                {
                    base.OnLoadComplete(e);

                    base.ContextMenu.Items.AddSeparator();

                    lockAr = new BooleanCommand
                    {
                        MenuText    = "Lock aspect ratio",
                        DataContext = App.Settings
                    };

                    areaClipping = new BooleanCommand
                    {
                        MenuText    = "Area clipping",
                        DataContext = App.Settings
                    };

                    ignoreOutsideArea = new BooleanCommand
                    {
                        MenuText    = "Ignore input outside area",
                        DataContext = App.Settings
                    };

                    base.ContextMenu.Items.AddRange(
                        new Command[]
                    {
                        lockAr,
                        areaClipping,
                        ignoreOutsideArea
                    }
                        );

                    base.ContextMenu.Items.AddSeparator();

                    base.ContextMenu.Items.Add(
                        new ActionCommand
                    {
                        MenuText = "Convert area...",
                        Action   = async() => await ConvertAreaDialog()
                    }
                        );

                    Rebind(App.Settings);
                    App.SettingsChanged += Rebind;
                }
コード例 #4
0
        public static Command Create(string argname, TypeEnum type, string value)
        {
            switch (type)
            {
            case TypeEnum.String:
                return(StringCommand.Create(argname, value));

            case TypeEnum.Int:
                return(IntCommand.Create(argname, value));

            case TypeEnum.Bool:
                return(BooleanCommand.Create(argname, value));

            default:
                // TODO: Handle not supported types
                throw new NotImplementedException();
            }
        }
コード例 #5
0
ファイル: ControlLinker.cs プロジェクト: mdehoog/iScanControl
 private BooleanConnector ConnectBooleanControl(BooleanCommand command, CheckBox control, Label label, CommandCategory category)
 {
     return(new BooleanConnector(command, control, label, category));
 }
コード例 #6
0
 public BooleanConnector(BooleanCommand command, CheckBox control, Label label, CommandCategory category)
     : base(command, control, label, category)
 {
     Control.CheckedChanged += new EventHandler(UpdateEnableables);
 }