예제 #1
0
        private void CalculateKeypadCode(ICollection <string> codes, IKeypad keypad)
        {
            var code = _bathroomCode.Aggregate(string.Empty,
                                               (current, s) => CalculateInstructionsLine(keypad, current, s));

            codes.Add(code);
        }
예제 #2
0
 public Withdrawal(int userAccount, IScreen atmScreen,
                   IBankDatabase atmBankDatabase, IKeypad atmKeypad, ICashDispenser atmCashDispenser)
     : base(userAccount, atmBankDatabase, atmScreen)
 {
     _keypad        = atmKeypad;
     _cashDispenser = atmCashDispenser;
 }
예제 #3
0
 public Deposit(int userAccountNumber, IScreen atmScreen,
                IBankDatabase atmBankDatabase, IKeypad atmKeypad, IDepositSlot atmDepositSlot)
     : base(userAccountNumber, atmBankDatabase, atmScreen)
 {
     _keypad      = atmKeypad;
     _depositSlot = atmDepositSlot;
 }
예제 #4
0
        public bool Initialize()
        {
            lock (action_lock)
            {
                if (!IsInitialized())
                {
                    try
                    {
                        if (!Chroma.SdkAvailable)
                        {
                            throw new Exception("No Chroma SDK available");
                        }

                        Chroma.Instance.Initialize();

                        Global.logger.LogLine("Razer device, Initialized", Logging_Level.Info);

                        keyboard = Chroma.Instance.Keyboard;
                        mouse    = Chroma.Instance.Mouse;
                        headset  = Chroma.Instance.Headset;
                        mousepad = Chroma.Instance.Mousepad;
                        keypad   = Chroma.Instance.Keypad;

                        if (keyboard == null &&
                            mouse == null &&
                            headset == null &&
                            mousepad == null &&
                            keypad == null
                            )
                        {
                            throw new Exception("No devices connected");
                        }
                        else
                        {
                            if (Global.Configuration.razer_first_time)
                            {
                                RazerInstallInstructions instructions = new RazerInstallInstructions();
                                instructions.ShowDialog();

                                Global.Configuration.razer_first_time = false;
                                Settings.ConfigManager.Save(Global.Configuration);
                            }

                            isInitialized = true;
                            return(true);
                        }
                    }
                    catch (Exception ex)
                    {
                        Global.logger.LogLine("Razer device, Exception! Message:" + ex, Logging_Level.Error);
                    }

                    isInitialized = false;
                    return(false);
                }

                return(isInitialized);
            }
        }
예제 #5
0
        private static string CalculateInstructionsLine(IKeypad keypad, string code, string instruction)
        {
            foreach (var step in instruction)
            {
                keypad.Walk(step);
            }

            code = code + keypad.CurrentPosition.Name;
            return(code);
        }
예제 #6
0
 /// <summary>
 /// no-argument ATM constructor initializes instance variables
 /// </summary>
 public ATM(ICashDispenser cashDispenser, IBankDatabase bankDatabase, IDepositSlot depositSlot, IKeypad keypad, IScreen screen, IMenu menu)
 {
     _userAuthenticated    = false;
     _currentAccountNumber = 0;
     _depositSlot          = depositSlot;
     _keypad        = keypad;
     _screen        = screen;
     _menu          = menu;
     _cashDispenser = cashDispenser;
     _bankDatabase  = bankDatabase;
 }
예제 #7
0
        public MenuPrincipal()
        {
            this.keypad = new Keypad();
            this.keypad.SoundsChange   += Keypad_SoundsChange;
            this.keypad.TagsChange     += Keypad_TagsChange;
            this.keypad.PlayListChange += Keypad_PlayListChange;
            InitializeComponent();
            this.playListLeft = this.panelPlayList.Left;
            this.defaultSize  = this.Size;
            this.minSize      = new Size(1122, this.Size.Height);
            this.comboBoxPlayList.ValueMember   = "Name";
            this.comboBoxPlayList.DisplayMember = "Name";

            //this.checkedListBoxTags.Items.AddRange(this.GetTagList().ToArray());
        }
예제 #8
0
        public bool Initialize()
        {
            lock (action_lock)
            {
                if (!IsInitialized())
                {
                    try
                    {
                        if (!Chroma.SdkAvailable)
                        {
                            throw new Exception("No Chroma SDK available");
                        }

                        Chroma.Instance.Initialize();

                        Global.logger.Info("Razer device, Initialized");

                        keyboard = Chroma.Instance.Keyboard;
                        mouse    = Chroma.Instance.Mouse;
                        headset  = Chroma.Instance.Headset;
                        mousepad = Chroma.Instance.Mousepad;
                        keypad   = Chroma.Instance.Keypad;

                        if (keyboard == null &&
                            mouse == null &&
                            headset == null &&
                            mousepad == null &&
                            keypad == null
                            )
                        {
                            throw new Exception("No devices connected");
                        }
                        else
                        {
                            /*if (Chroma.Instance.Query(Corale.Colore.Razer.Devices.BladeStealth).Connected || Chroma.Instance.Query(Corale.Colore.Razer.Devices.Blade14).Connected)
                             *  bladeLayout = true;*/

                            if (Global.Configuration.razer_first_time)
                            {
                                RazerInstallInstructions instructions = new RazerInstallInstructions();
                                instructions.ShowDialog();

                                Global.Configuration.razer_first_time = false;
                                Settings.ConfigManager.Save(Global.Configuration);
                            }

                            isInitialized = true;
                            return(true);
                        }
                    }
                    catch (Exception ex)
                    {
                        Global.logger.Error("Razer device, Exception! Message:" + ex);
                    }

                    isInitialized = false;
                    return(false);
                }

                return(isInitialized);
            }
        }
예제 #9
0
 public T9MessageTranslator(IKeypad keypad)
 {
     _keypad = keypad;
 }
예제 #10
0
 public Converter(IKeypad keypad)
 {
     Keypad = keypad;
 }
예제 #11
0
 public T9MessageTranslator_TranslateMessageShould()
 {
     _keypad     = new T9Keypad();
     _translator = new T9MessageTranslator(_keypad);
 }
예제 #12
0
 public FileConverter(IKeypad keypad, string inFile) : base(keypad)
 {
     _inFile  = inFile;
     _outFile = Path.ChangeExtension(_inFile, ".out");
 }
예제 #13
0
        public ITransaction CreateTransaction(int type, int currentAccountNumber, IBankDatabase atmBankDatabase, IScreen atmScreen, IKeypad atmKeypad, ICashDispenser atmCashDispenser, IDepositSlot atmDepositSlot)
        {
            ITransaction temp = null;

            switch (type)
            {
            case 1:
                temp = new BalanceInquiry(currentAccountNumber, atmScreen, atmBankDatabase);
                break;

            case 2:
                temp = new Withdrawal(currentAccountNumber, atmScreen, atmBankDatabase, atmKeypad, atmCashDispenser);
                break;

            case 3:
                temp = new Deposit(currentAccountNumber, atmScreen, atmBankDatabase, atmKeypad, atmDepositSlot);
                break;
            }

            return(temp);
        }
예제 #14
0
 public CalculatorInterface(IScreen screen, IKeypad keypad)
 {
     this.screen = screen;
     this.keypad = keypad;
 }
예제 #15
0
 public KeypadClicker(IKeypad keypad, KeypadButton startButton = KeypadButton.Button5)
 {
     _keypad       = keypad;
     CurrentButton = startButton;
 }