コード例 #1
0
ファイル: Withdrawal.cs プロジェクト: Kazempour/src
    private Keypad keypad; // reference to Keypad

    #endregion Fields

    #region Constructors

    // five-parameter constructor
    public Withdrawal( int userAccountNumber, Screen atmScreen, 
        BankDatabase atmBankDatabase, Keypad atmKeypad,
        CashDispenser atmCashDispenser)
        : base(userAccountNumber, atmScreen, atmBankDatabase)
    {
        // initialize references to keypad and cash dispenser
          keypad = atmKeypad;
          cashDispenser = atmCashDispenser;
    }
コード例 #2
0
ファイル: ATM.cs プロジェクト: Kazempour/src
    private bool userAuthenticated; // true if user is authenticated

    #endregion Fields

    #region Constructors

    // parameterless constructor initializes instance variables
    public ATM()
    {
        userAuthenticated = false; // user is not authenticated to start
          currentAccountNumber = 0; // no current account number to start
          screen = new Screen(); // create screen
          keypad = new Keypad(); // create keypad
          cashDispenser = new CashDispenser(); // create cash dispenser
          depositSlot = new DepositSlot(); // create deposit slot
          bankDatabase = new BankDatabase(); // create account info database
    }
コード例 #3
0
ファイル: KeypadSquare.cs プロジェクト: spc348/Decoder
	void Start ()
	{
		keypad = GetComponentInParent <Keypad> ();
		squareRend = GetComponent <SpriteRenderer> ();
		col = GetComponent <BoxCollider2D> ();

		squareText = GetComponentInChildren<Text> ();
		squareText.text = Letter;

		Activate ();
	}
コード例 #4
0
        public void InternalReset(bool resetComponents)
        {
            // NOTE(Cristian): It's responsability of the view (or the calling audio code) to
            //                 handling and re-hooking correctly the audio on reset
            if (_state.Run)
            {
                this.Stop();
            }

            if (resetComponents)
            {
                _memory.Reset();
                _cpu.Reset();
                _interruptController.Reset();
                _display.Reset();
                _apu.Reset();
                _disassembler.Reset();
                //this.serial = new SerialSpace.SerialController(this.interruptController, this.memory);
            }

            // We re-hook information
            if (this._cartridge != null)
            {
                _apu.CartridgeFilename = this.CartridgeFilename;
                _memory.SetMemoryHandler(GBSharp.MemorySpace.MemoryHandlers.
                                         MemoryHandlerFactory.CreateMemoryHandler(this));
            }

            _buttons          = Keypad.None;
            _pauseEvent       = new ManualResetEvent(true);
            _manualResetEvent = new ManualResetEventSlim(false);

            _state.InBreakpoint = false;
            ReleaseButtons      = true;

            var disDef = _display.GetDisplayDefinition();

#if TIMING
            _timingSamples = new long[_sampleAmount * _maxSamples];
            _swCPU         = new Stopwatch();
            _swDisplay     = new Stopwatch();
            _swBlit        = new Stopwatch();
            _swClockMem    = new Stopwatch();
#endif
        }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        keys = keypad.GetComponent <Keypad> ();
        thoughtBubble.SetBool("Think", true);

        number1 = GetDividend(randomNumbers);
        number2 = GetDivisor();
        answer  = number1 / number2;

        remainder = (qType == QuestionType.withRemainder) ? number1 % number2 : 0;

        n1.text = number1.ToString();
        n2.text = number2.ToString();
        SetQuestionCarrots(true, number1, q_carrots);

        Invoke("PlayQuestionAudio", 1f);
        //SetQuestionCarrots(true, number2, dragCarrots);
    }
コード例 #6
0
        public DeviceContainer()
        {
            Keyboard   = new Keyboard();
            Headset    = new Headset();
            Mouse      = new Mouse();
            Mousepad   = new Mousepad();
            Keypad     = new Keypad();
            ChromaLink = new ChromaLink();

            Devices = new List <IDevice>()
            {
                Keyboard,
                Headset,
                Mouse,
                Mousepad,
                Keypad,
                ChromaLink
            };
        }
コード例 #7
0
    void Awake()
    {
        /* Singleton Shit */
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        /* Actual Shit */
        UI_Manager  = GetComponent <UI_Manager>();
        Keypad      = KeypadObject.GetComponent <Keypad>();
        LineManager = LineManagerObj.GetComponent <LineManager>();
        Scrambler   = ScramblerObj.GetComponent <Scrambler>();
    }
コード例 #8
0
        public Solution GetSolution(IInput input)
        {
            var keypad        = new Keypad();
            var specialKeypad = new SpecialKeypad();
            var result1       = new StringBuilder();
            var result2       = new StringBuilder();

            foreach (var line in input.GetLines())
            {
                foreach (var character in line)
                {
                    keypad.Move(character);
                    specialKeypad.Move(character);
                }
                result1.Append(keypad.GetCode());
                result2.Append(specialKeypad.GetCode());
            }

            return(new Solution(firstPart: result1, secondPart: result2));
        }
コード例 #9
0
        public Transaction CreateTransaction(MenuOption type,
                                             Keypad keypad, CashDispenser cashDispenser, DepositSlot depositSlot)
        {
            Transaction temp = null;

            switch (type)
            {
            case MenuOption.BalanceInquiry:
                temp = new BalanceInquiry(BankDatabase);
                break;

            case MenuOption.Withdrawal:
                temp = new Withdrawal(BankDatabase, keypad, cashDispenser);
                break;

            case MenuOption.Deposit:
                temp = new Deposit(BankDatabase, keypad, depositSlot);
                break;
            }

            return(temp);
        }
コード例 #10
0
ファイル: TlfIaView.cs プロジェクト: agluque62/svn-dev_TFT
        public TlfIaView([ServiceDependency] WorkItem workItem, [ServiceDependency] IModelCmdManagerService cmdManager, [ServiceDependency] StateManagerService stateManager)
        {
            InitializeComponent();
            _IaToolsWS.Name = WorkspaceNames.IaToolsWorkspace;

            _WorkItem      = workItem;
            _CmdManager    = cmdManager;
            _StateManager  = stateManager;
            _SlowBlinkList = new Dictionary <HMIButton, Color>();

            int pos = 0;

            foreach (string num in Settings.Default.Historic)
            {
                string[] numAlias = num.Split(',');
                _Historic[pos++] = new Number(numAlias[0], numAlias[1]);
            }

            _Keypad = _WorkItem.SmartParts.AddNew <Keypad>(ViewNames.KeypadView);
            _Mem    = _WorkItem.SmartParts.AddNew <MemUC>(ViewNames.MemView);

            _Keypad.NewKey     += OnKeypadNewKey;
            _Keypad.ClearClick += OnKeypadClear;
            _Mem.OkClick       += OnMemOkClick;
            _Mem.CancelClick   += OnMemCancelClick;

            _Num1BT.Tag = 0;
            _Num2BT.Tag = 1;
            _Num3BT.Tag = 2;
            _Num4BT.Tag = 3;

            // Miguel
            _Num1BT.Text = _Historic[0] != null ? _Historic[0].Alias : _Num1;
            _Num2BT.Text = _Historic[1] != null ? _Historic[1].Alias : _Num2;
            _Num3BT.Text = _Historic[2] != null ? _Historic[2].Alias : _Num3;
            _Num4BT.Text = _Historic[3] != null ? _Historic[3].Alias : _Num4;

            _MemBT.Text = _MEM; // Miguel
        }
コード例 #11
0
ファイル: Common.cs プロジェクト: butler1233/CardsApp
        internal async static Task <int> RequestUserKeypad(Page context)
        {
            var Keypad = new Keypad();
            await context.Navigation.PushModalAsync(Keypad);

            await Task.Run(() =>
            {
                while (Keypad.StillOpen)
                {
                    Thread.Sleep(10);
                }
            });

            if (Keypad.Return)
            {
                return(Keypad.Value);
            }
            else
            {
                throw new ArgumentNullException("No value was submitted.");
            }
        }
コード例 #12
0
ファイル: KeypadConfig.ascx.cs プロジェクト: mitsbits/CC
    protected void btnRandomize_OnClick(object sender, EventArgs e)
    {
        var defKeyPad   = new Keypad(1, 1);
        var alphabet    = string.Join("", defKeyPad.ToConfig().ToArray());
        var randomChars = alphabet.ToList().Shuffle();
        var randConfig  = new Dictionary <int, string>();
        var rand        = new Random();

        foreach (var randomChar in randomChars)
        {
            var key = rand.Next(1, 10);
            if (randConfig.ContainsKey(key))
            {
                var line = randConfig[key];
                line           += randomChar;
                randConfig[key] = line;
            }
            else
            {
                randConfig[key] = randomChar.ToString();
            }
        }
        var config = new List <string>();

        for (var key = 1; key <= 9; key++)
        {
            config.Add(randConfig.ContainsKey(key) ? randConfig[key] : string.Empty);
        }
        var assistant     = new Service();
        var currentKeypad = assistant.Keypad(Session);
        var keypad        = new Keypad(currentKeypad.TypingTime, currentKeypad.FixingTime, config.ToArray());

        assistant.SetKeyPad(Session, keypad);
        rptrConfig.DataSource = config;
        rptrConfig.DataBind();
        pnlError.Visible     = false;
        lblErrorMessage.Text = string.Empty;
    }
コード例 #13
0
ファイル: FileConverter.cs プロジェクト: gonsovsky/aspose
 public override void Convert()
 {
     using (FileStream outfile = new FileStream(_outFile, FileMode.Create, FileAccess.Write, FileShare.Read))
         using (StreamWriter writer = new StreamWriter(outfile, Encoding.Unicode))
         {
             FileStream infile = new FileStream(_inFile, FileMode.Open, FileAccess.Read);
             var        no     = 0;
             using (StreamReader reader = new StreamReader(infile, Encoding.UTF8))
             {
                 string line = String.Empty;
                 while ((line = reader.ReadLine()) != null)
                 {
                     no++;
                     if (no <= 2) //Skip first 2 lines of Google's input file.
                     {
                         continue;
                     }
                     line = Keypad.Encode(line);
                     writer.WriteLine($"Case #{no-2} {line}");
                 }
             }
         }
 }
コード例 #14
0
        protected virtual void HandleOperator(string key)
        {
            try {
                Calculator.Add(key);

                if (Calculator.IsSpecialKey(key))
                {
                    DisplayValue(Calculator.Input);

                    return;
                }

                DisplayValue(Calculator.LastResult.ToString());
            }
            catch (DivideByZeroException) {
                Display.DisplayError(_divideByZeroMessage);
                Keypad.LeaveBasicKeysOn();
            }
            catch (Exception) {
                Display.DisplayError(_invalidInputMessage);
                Keypad.LeaveBasicKeysOn();
            }
        }
コード例 #15
0
        private void TapGestureRecognizer_Tapped_1(object sender, EventArgs e)
        {
            if (ShowKeys)
            {
                PeopleCountSlider.FadeTo(0, 1);
                PeopleCountSlider.InputTransparent = true;
                TipSelector.FadeTo(0, 1);
                TipSelector.InputTransparent = true;
                Keypad.FadeTo(0, 1);
                Keypad.InputTransparent = true;

                BillSplit.FadeTo(1, 1);

                BillSplit.InputTransparent = false;

                //if (BillSplit.TranslationY >= 0)
                //    BillSplit.TranslateTo(0, -(MainGrid.RowDefinitions[4].Height.Value / 100 * Height), 500);

                BillSplit.SplitBill();
                BillSplit.TranslateTo(0, 0, 500);
            }
            else
            {
                BillSplit.FadeTo(0, 1);
                BillSplit.InputTransparent = true;
                //BillSplit.TranslateTo(0, -BillSplit.Height, 0);

                PeopleCountSlider.FadeTo(1, 1);
                PeopleCountSlider.InputTransparent = false;
                TipSelector.FadeTo(1, 1);
                TipSelector.InputTransparent = false;
                Keypad.FadeTo(1, 1);
                Keypad.InputTransparent = false;
            }

            ShowKeys = !ShowKeys;
        }
コード例 #16
0
        public Outputs Create(Inputs inputs)
        {
            EventLoop <Fuel> eStart = new EventLoop <Fuel>();
            Fill             fi     = new Fill(inputs.EClearSale.Map(u => Unit.UNIT),
                                               inputs.EFuelPulses, inputs.Calibration,
                                               inputs.Price1, inputs.Price2, inputs.Price3,
                                               eStart);
            NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.ENozzle1,
                              inputs.ENozzle2,
                              inputs.ENozzle3),
                inputs.EClearSale,
                fi);

            eStart.Loop(np.EStart);
            BehaviorLoop <bool> keypadActive = new BehaviorLoop <bool>();
            Keypad ke = new Keypad(inputs.EKeypad,
                                   inputs.EClearSale,
                                   keypadActive);
            Preset pr = new Preset(ke.Value,
                                   fi,
                                   np.FuelFlowing,
                                   np.FillActive.Map(o => o.IsPresent));

            keypadActive.Loop(pr.KeypadActive);
            return(new Outputs()
                   .SetDelivery(pr.Delivery)
                   .SetSaleCostLcd(fi.DollarsDelivered.Map(q => Formatters.FormatSaleCost(q)))
                   .SetSaleQuantityLcd(fi.LitersDelivered.Map(q => Formatters.FormatSaleQuantity(q)))
                   .SetPriceLcd1(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price, Fuel.ONE, inputs))
                   .SetPriceLcd2(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price, Fuel.TWO, inputs))
                   .SetPriceLcd3(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price, Fuel.THREE, inputs))
                   .SetSaleComplete(np.ESaleComplete)
                   .SetPresetLcd(ke.Value.Map(v => Formatters.FormatSaleCost((double)v)))
                   .SetBeep(np.EBeep.Merge(ke.EBeep)));
        }
コード例 #17
0
    public void Start()
    {
        // ReSharper disable once SpecifyACultureInStringConversionExplicitly
        _buttonId = Random.value.ToString();
        _prefix   = "[UdonKeypad] [b-" + _buttonId + "] ";

        Log("Loading button... Value: " + buttonValue);
        if (keypad == null)
        {
            LogError("Keypad is not set! Trying to dynamically find object...");
            var obj = GameObject.Find("Keypad");
            if (obj != null)
            {
                keypad = (Keypad)obj.GetComponent(typeof(UdonBehaviour));
            }
            else
            {
                LogError("Keypad is not set and could not dynamically find parent! Dying...");
                Die();
            }
        }

        if (buttonValue == null)
        {
            LogError("Keypad is not set! Resetting to calculated value: " + gameObject.name.Substring(12));
            buttonValue = gameObject.name.Substring(12);
        }

        if (buttonValue.Length != 1 && buttonValue != "OK" && buttonValue != "CLR")
        {
            LogError("Button has invalid value! Resetting to 'X'. OldValue: '" + buttonValue + "'.");
            buttonValue = "X";
        }

        Log("Button started! Value: " + buttonValue);
    }
コード例 #18
0
 public Key this[Keypad keypad]
 {
     get
     {
         foreach (Keymap map in _mapping)
         {
             if (map.Keypad == keypad)
             {
                 return(map.Key);
             }
         }
         return(0);
     }
     set
     {
         foreach (Keymap map in _mapping)
         {
             if (map.Keypad == keypad)
             {
                 map.Key = value;
             }
         }
     }
 }
コード例 #19
0
        public ActionResult GetCode(CodeInstructions procedure)
        {
            BathroomCode input  = new BathroomCode();
            var          reader = new StringReader(procedure.Instructions);
            string       line;
            Keypad       keypad = new Keypad();

            keypad.ButtonsTraversed.Add(5); //start at 5, middle of keypad
            while (null != (line = reader.ReadLine()))
            {
                char[] array = line.ToCharArray();

                // Loop through array.
                for (int i = 0; i < array.Length; i++)
                {
                    // Get character from array.
                    char  letter = array[i];
                    IMove mover  = MoverFactory.GetMover(letter);
                    keypad.Move(mover);
                }
                input.Code.Add(keypad.ButtonsTraversed.Last());
            }
            return(PartialView("Code", input));
        }
コード例 #20
0
 public void KeypadSuccess(Keypad keypad)
 {
     passLight.enabled = true;
 }
コード例 #21
0
 void Start()
 {
     player       = GameObject.FindWithTag("MainCamera");   // Find the object tagged as MainCamera
     head         = Camera.main.GetComponent <StereoController>().Head;
     keypadScript = keypadObj.GetComponent <Keypad> ();
 }
コード例 #22
0
 public void Keypad_NextSymbol_LowerCase_Exception()
 {
     var keypad = new Keypad("2ABC");
     var test   = keypad.NextSymbol('a');
 }
コード例 #23
0
 // Use this for initialization
 void Start()
 {
     keypad     = Door.GetComponent <Keypad>();
     m_Collider = GetComponent <Collider>();
     //var myScript Keypad = GetComponent.<Keypad>();
 }
コード例 #24
0
        public void KeyPad_CannAccept_AlphabetsNotRegistered_ReturnsFalse()
        {
            var keypad = new Keypad("0,1ABC");

            Assert.IsFalse(keypad.CanAccept("D"));
        }
コード例 #25
0
 public void Keypad_NextSymbol_InvalidKey_Exception()
 {
     var keypad = new Keypad("2ABC");
     var test   = keypad.NextSymbol('3');
 }
コード例 #26
0
 private void SetPressMode(Keypad keypad)
 {
     SetMode = true;
     _keypadToBeSet = keypad;
     Refresh();
 }
コード例 #27
0
        public void Keypad_E16KeyGroup_DefinedCorrectly(char value, char expected)
        {
            var keypad = new Keypad(Keypad.E161_PHONE_KEY_GROUPS);

            Assert.AreEqual(expected, keypad.NextSymbol(value));
        }
コード例 #28
0
ファイル: GameBoy.cs プロジェクト: cristiandonosoc/GBSharp
 /// <summary>
 /// Call this method when a button is released in the user interface.
 /// </summary>
 /// <param name="button">The button that was released. It can be a combination of buttons too.</param>
 public void ReleaseButton(Keypad button)
 {
     if (button != Keypad.Speed)
     {
         if (ReleaseButtons)
         {
             _buttons &= ~button;
             _interruptController.UpdateKeypadState(_buttons);
         }
     }
     else
     {
         FastEmulation = false;
         _apu.DepleteSoundEventQueues();
     }
 }
コード例 #29
0
 void Start()
 {
     cam    = GetComponent <Camera>();
     keypad = GetComponent <Keypad>();
 }
コード例 #30
0
 /// <summary>
 /// This method is intended to be used when a button is pressed or released in the user interface.
 /// Updates the internal state of the buttons in the interrupt controller and determines if an interrupt is necessary.
 /// </summary>
 /// <param name="buttons">The new state of the buttons</param>
 public void UpdateKeypadState(Keypad buttons)
 {
     _state.PressedButtons = (byte)buttons; // This only works because the magic values we chose for the Keypad enum
       this.UpdateKeypadState();
 }
コード例 #31
0
 public PathFinder(Keypad keypad)
 {
     _keypad = keypad;
 }
コード例 #32
0
 private void SetPressMode(Keypad keypad)
 {
     SetMode        = true;
     _keypadToBeSet = keypad;
     Refresh();
 }
コード例 #33
0
ファイル: GameBoy.cs プロジェクト: cristiandonosoc/GBSharp
 /// <summary>
 /// Call this method when a button is pressed in the user interface.
 /// </summary>
 /// <param name="button">The button that was pressed. It can be a combination of buttons too.</param>
 public void PressButton(Keypad button)
 {
     if (button != Keypad.Speed)
     {
         _buttons |= button;
         _interruptController.UpdateKeypadState(_buttons);
         if (_cpu.Stopped) { _cpu.Stopped = false; }
     }
     else
     {
         FastEmulation = true;
     }
 }
コード例 #34
0
 internal Keymap(Key key, Keypad keypad)
 {
     Key    = key;
     Keypad = keypad;
 }
コード例 #35
0
 private void Awake()
 {
     instance = this;
 }
コード例 #36
0
 public void KeypadFailure(Keypad keypad)
 {
     failLight.enabled = true;
 }
コード例 #37
0
 public void KeypadUpdated(Keypad keypad)
 {
     Debug.Log(keypad.KeypadValue);
     passLight.enabled = false;
     failLight.enabled = false;
 }
コード例 #38
0
ファイル: GameBoy.cs プロジェクト: cristiandonosoc/GBSharp
        public void InternalReset(bool resetComponents)
        {
            // NOTE(Cristian): It's responsability of the view (or the calling audio code) to
            //                 handling and re-hooking correctly the audio on reset
            if (_state.Run) { this.Stop(); }

            if (resetComponents)
            {
                _memory.Reset();
                _cpu.Reset();
                _interruptController.Reset();
                _display.Reset();
                _apu.Reset();
                _disassembler.Reset();
                //this.serial = new SerialSpace.SerialController(this.interruptController, this.memory);
            }

            // We re-hook information
            if (this._cartridge != null)
            {
                _apu.CartridgeFilename = this.CartridgeFilename;
                _memory.SetMemoryHandler(GBSharp.MemorySpace.MemoryHandlers.
                                         MemoryHandlerFactory.CreateMemoryHandler(this));
            }

            _buttons = Keypad.None;
            _pauseEvent = new ManualResetEvent(true);
            _manualResetEvent = new ManualResetEventSlim(false);

            _state.InBreakpoint = false;
            ReleaseButtons = true;

            var disDef = _display.GetDisplayDefinition();

            #if TIMING
              _timingSamples = new long[_sampleAmount * _maxSamples];
              _swCPU = new Stopwatch();
              _swDisplay = new Stopwatch();
              _swBlit = new Stopwatch();
              _swClockMem = new Stopwatch();
            #endif
        }