Пример #1
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.svGates = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 2:
     this.tbNot = ((GatesWpf.UIGates.Not)(target));
     return;
     case 3:
     this.tbAnd = ((GatesWpf.UIGates.And)(target));
     return;
     case 4:
     this.tbOr = ((GatesWpf.UIGates.Or)(target));
     return;
     case 5:
     this.tbBuffer = ((GatesWpf.UIGates.Buffer)(target));
     return;
     case 6:
     this.tbNand = ((GatesWpf.UIGates.Nand)(target));
     return;
     case 7:
     this.tbNor = ((GatesWpf.UIGates.Nor)(target));
     return;
     case 8:
     this.tbXor = ((GatesWpf.UIGates.Xor)(target));
     return;
     case 9:
     this.tbXnor = ((GatesWpf.UIGates.Xnor)(target));
     return;
     case 10:
     this.tbUserInput = ((GatesWpf.UIGates.UserInput)(target));
     return;
     case 11:
     this.tbUserOutput = ((GatesWpf.UIGates.UserOutput)(target));
     return;
     case 12:
     this.tbNumericOutput = ((GatesWpf.UIGates.DefaultNumericOutput)(target));
     return;
     case 13:
     this.tbNumericInput = ((GatesWpf.UIGates.DefaultNumericInput)(target));
     return;
     case 14:
     this.tbClock = ((GatesWpf.UIGates.Clock)(target));
     return;
     case 15:
     this.tbComment = ((GatesWpf.UIGates.Comment)(target));
     return;
     case 16:
     this.expUserGates = ((System.Windows.Controls.Expander)(target));
     return;
     case 17:
     this.spGates = ((System.Windows.Controls.StackPanel)(target));
     return;
     }
     this._contentLoaded = true;
 }
Пример #2
0
        /// <summary>
        /// Add a gate to this canvas.  An appropriate visual representation will be created.
        /// </summary>
        /// <param name="gate"></param>
        /// <param name="pos"></param>
        public void AddGate(Gates.AbstractGate gate, GateLocation pos)
        {
            // maybe we could use extension methods
            // to add a method to create a UIGate for each AbstractGate?

            Gate uigate;
            if (gate is Gates.BasicGates.And)
            {
                uigate = new UIGates.And((Gates.BasicGates.And)gate);
            }
            else if (gate is Gates.BasicGates.Not)
            {
                uigate = new UIGates.Not((Gates.BasicGates.Not)gate);
            }
            else if (gate is Gates.BasicGates.Or)
            {
                uigate = new UIGates.Or((Gates.BasicGates.Or)gate);
            }
            else if (gate is Gates.BasicGates.Nand)
            {
                uigate = new UIGates.Nand((Gates.BasicGates.Nand)gate);
            }
            else if (gate is Gates.BasicGates.Nor)
            {
                uigate = new UIGates.Nor((Gates.BasicGates.Nor)gate);
            }
            else if (gate is Gates.BasicGates.Xor)
            {
                uigate = new UIGates.Xor((Gates.BasicGates.Xor)gate);
            }
            else if (gate is Gates.BasicGates.Xnor)
            {
                uigate = new UIGates.Xnor((Gates.BasicGates.Xnor)gate);
            }
            else if (gate is Gates.BasicGates.Buffer)
            {
                uigate = new UIGates.Buffer((Gates.BasicGates.Buffer)gate);
            }
            else if (gate is Gates.IOGates.UserInput)
            {
                uigate = new UIGates.UserInput((Gates.IOGates.UserInput)gate);
            }
            else if (gate is Gates.IOGates.UserOutput)
            {
                uigate = new UIGates.UserOutput((Gates.IOGates.UserOutput)gate);
            }
            else if (gate is Gates.IOGates.AbstractNumeric)
            {
                uigate = new UIGates.Numeric((Gates.IOGates.AbstractNumeric)gate);
            }
            else if (gate is Gates.IOGates.Clock)
            {
                uigate = new UIGates.Clock((Gates.IOGates.Clock)gate);
            }
            else if (gate is Gates.IOGates.Comment)
            {
                uigate = new UIGates.Comment((Gates.IOGates.Comment)gate);
            }
            else if (gate is Gates.IC)
            {
                uigate = UIGates.IC.CreateFromTemplate((Gates.IC)gate, icl.GetIC(gate.Name));
            }
            else throw new ArgumentException("gate not of known subclass");

            AddGate(uigate, pos);
        }
Пример #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.svGates = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 2:
                this.tbNot = ((GatesWpf.UIGates.Not)(target));
                return;

            case 3:
                this.tbAnd = ((GatesWpf.UIGates.And)(target));
                return;

            case 4:
                this.tbOr = ((GatesWpf.UIGates.Or)(target));
                return;

            case 5:
                this.tbBuffer = ((GatesWpf.UIGates.Buffer)(target));
                return;

            case 6:
                this.tbNand = ((GatesWpf.UIGates.Nand)(target));
                return;

            case 7:
                this.tbNor = ((GatesWpf.UIGates.Nor)(target));
                return;

            case 8:
                this.tbXor = ((GatesWpf.UIGates.Xor)(target));
                return;

            case 9:
                this.tbXnor = ((GatesWpf.UIGates.Xnor)(target));
                return;

            case 10:
                this.tbUserInput = ((GatesWpf.UIGates.UserInput)(target));
                return;

            case 11:
                this.tbUserOutput = ((GatesWpf.UIGates.UserOutput)(target));
                return;

            case 12:
                this.tbNumericOutput = ((GatesWpf.UIGates.DefaultNumericOutput)(target));
                return;

            case 13:
                this.tbNumericInput = ((GatesWpf.UIGates.DefaultNumericInput)(target));
                return;

            case 14:
                this.tbClock = ((GatesWpf.UIGates.Clock)(target));
                return;

            case 15:
                this.tbComment = ((GatesWpf.UIGates.Comment)(target));
                return;

            case 16:
                this.expUserGates = ((System.Windows.Controls.Expander)(target));
                return;

            case 17:
                this.spGates = ((System.Windows.Controls.StackPanel)(target));
                return;
            }
            this._contentLoaded = true;
        }