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; } }
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; }
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; }
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(); } }
private BooleanConnector ConnectBooleanControl(BooleanCommand command, CheckBox control, Label label, CommandCategory category) { return(new BooleanConnector(command, control, label, category)); }
public BooleanConnector(BooleanCommand command, CheckBox control, Label label, CommandCategory category) : base(command, control, label, category) { Control.CheckedChanged += new EventHandler(UpdateEnableables); }