예제 #1
0
        private void StartLevel(int levelNumber)
        {
            Game level = new Game(levelNumber);

            bool won = false;

            while (!won)
            {
                OutputView.DrawLevel(level.Map, false);
                GameAction action = InputView.AwaitActionGame();

                if (action == GameAction.Stop)
                {
                    break;
                }
                else if (action != GameAction.Invalid)
                {
                    level.ApplyAction(action);

                    won = level.HasWon();
                }
            }

            if (won)
            {
                OutputView.DrawLevel(level.Map, true);
                InputView.AwaitAnyKey();
            }
        }
예제 #2
0
        void UpdateInputScope()
        {
            if (_queryTextBox == null)
            {
                return;
            }

            InputView model = Element;

            if (model.Keyboard is CustomKeyboard custom)
            {
                _queryTextBox.IsTextPredictionEnabled = (custom.Flags & KeyboardFlags.Suggestions) != 0;
                _queryTextBox.IsSpellCheckEnabled     = (custom.Flags & KeyboardFlags.Spellcheck) != 0;
            }
            else
            {
                _queryTextBox.ClearValue(TextBox.IsTextPredictionEnabledProperty);

                if (model.IsSet(InputView.IsSpellCheckEnabledProperty))
                {
                    _queryTextBox.IsSpellCheckEnabled = model.IsSpellCheckEnabled;
                }
                else
                {
                    _queryTextBox.ClearValue(TextBox.IsSpellCheckEnabledProperty);
                }
            }

            _queryTextBox.InputScope = model.Keyboard.ToInputScope();
        }
예제 #3
0
        public Controller()
        {
            _inputView = new InputView();
            _outputView = new OutputView();

            InitializeTimers();
        }
예제 #4
0
        public static void UpdateText(this TextBox platformControl, InputView inputView)
        {
            var hasFocus      = platformControl.FocusState != UI.Xaml.FocusState.Unfocused;
            var passwordBox   = platformControl as MauiPasswordTextBox;
            var isPassword    = passwordBox?.IsPassword ?? false;
            var textTransform = inputView?.TextTransform ?? TextTransform.None;

            // Setting the text causes the cursor to be reset to position zero.
            // So, let's retain the current cursor position and calculate a new cursor
            // position if the text was modified by a Converter.
            var oldText = platformControl.Text ?? string.Empty;
            var newText = TextTransformUtilites.GetTransformedText(
                inputView?.Text,
                isPassword ? TextTransform.None : textTransform
                );

            // Re-calculate the cursor offset position if the text was modified by a Converter.
            // but if the text is being set by code, let's just move the cursor to the end.
            var cursorOffset   = newText.Length - oldText.Length;
            int cursorPosition = hasFocus ? platformControl.GetCursorPosition(cursorOffset) : newText.Length;

            if (oldText != newText && passwordBox is not null)
            {
                passwordBox.Password = newText;
            }
            else if (oldText != newText)
            {
                platformControl.Text = newText;
            }

            platformControl.Select(cursorPosition, 0);
        }
        public void addBottomLine()
        {
            //if bottomLineView?.superview != nil {
            //    return
            //}
            //Bottom Line UIView Configuration.
            var bottomLineView = new UIView();

            bottomLineView.BackgroundColor = activeColor;
            bottomLineView.TranslatesAutoresizingMaskIntoConstraints = false;
            bottomLineView.Frame = new CGRect(0, 60, 335, 2);
            InputView.AddSubview(bottomLineView);


            //let leadingConstraint = NSLayoutConstraint.init(item: bottomLineView!, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading, multiplier: 1, constant: 0)
            //let trailingConstraint = NSLayoutConstraint.init(item: bottomLineView!, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1, constant: 0)
            //let bottomConstraint = NSLayoutConstraint.init(item: bottomLineView!, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1, constant: 0)
            //bottomLineViewHeight = NSLayoutConstraint.init(item: bottomLineView!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 1)


            //self.addConstraints([leadingConstraint, trailingConstraint, bottomConstraint])
            //bottomLineView?.addConstraint(bottomLineViewHeight!)


            //self.addTarget(self, action: #selector(self.textfieldEditingChanged), for: .editingChanged)
        }
예제 #6
0
        public static void UpdateText(this EditText editText, InputView inputView)
        {
            // Is UpdateText being called only to transform the text
            // that's already set on the platform element?
            // If so then we want to retain the cursor position
            bool transformingPlatformText =
                (editText.Text == inputView.Text);

            var value = TextTransformUtilites.GetTransformedText(inputView.Text, inputView.TextTransform);

            if (!transformingPlatformText)
            {
                editText.Text = value;
            }
            else
            {
                // Setting the text causes the cursor to reset to position zero
                // so if we are transforming the text and then setting it to a
                // new value then we need to retain the cursor position
                if (value == editText.Text)
                {
                    return;
                }

                int selectionStart = editText.SelectionStart;
                editText.Text = value;
                editText.SetSelection(selectionStart);
            }
        }
예제 #7
0
        public Controller()
        {
            _inputView  = new InputView();
            _outputView = new OutputView();

            InitializeTimers();
        }
예제 #8
0
        public static void UpdateText(this EditText editText, InputView inputView)
        {
            bool isPasswordEnabled =
                (editText.InputType & InputTypes.TextVariationPassword) == InputTypes.TextVariationPassword ||
                (editText.InputType & InputTypes.NumberVariationPassword) == InputTypes.NumberVariationPassword;

            // Setting the text causes the cursor to be reset to position zero.
            // So, let's retain the current cursor position and calculate a new cursor
            // position if the text was modified by a Converter.
            var oldText = editText.Text ?? string.Empty;
            var newText = TextTransformUtilites.GetTransformedText(
                inputView?.Text,
                isPasswordEnabled ? TextTransform.None : inputView.TextTransform
                );

            // Re-calculate the cursor offset position if the text was modified by a Converter.
            // but if the text is being set by code, let's just move the cursor to the end.
            var cursorOffset   = newText.Length - oldText.Length;
            int cursorPosition = editText.IsFocused ? editText.GetCursorPosition(cursorOffset) : newText.Length;

            if (oldText != newText)
            {
                editText.Text = newText;
            }

            editText.SetSelection(cursorPosition, cursorPosition);
        }
예제 #9
0
 public GameController()
 {
     this._inputView  = new InputView();
     this._outputView = new OutputView();
     this._fileReader = new FileReader();
     this.StartGame();
 }
예제 #10
0
 public void HandleDeselectionOnTapOutside(Action dismiss, InputView inputView)
 {
     inputView.Unfocused += (object sender, FocusEventArgs e) =>
     {
         // Console.WriteLine("focused: " + e.IsFocused);
         dismiss();
     };
 }
예제 #11
0
        public MainWindowViewModel()
        {
            SubmitOrderButtonContent = "Submit";

            SubmitOrderButtonCommand = new RelayCommand(ReturnButtonClick);

            ContentControlBinding = new InputView();
        }
예제 #12
0
 private void CloseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FuzzyApp.Initalize();
     variable1.ClearVariable();
     InputView.Clear();
     OutputView.Clear();
     reultsUI1.loadVariables();
 }
예제 #13
0
 protected void RequestFocus(InputView input)
 {
     Task.Run(async() =>
     {
         await Task.Delay(ShowModalAnimationDelay);
         Device.BeginInvokeOnMainThread(() => input.Focus());
     });
 }
예제 #14
0
 public MainController()
 {
     game   = new Game();
     reader = new MazeReader(game);
     reader.CreateLinks(reader.ReadMaze(1));
     mazeView  = new MazeView(game);
     inputView = new InputView();
     run();
 }
예제 #15
0
        public GameController()
        {
            OutputView.PrintWelcomeMessage();
            InputView.PrintGameStart();

            Console.ReadLine();

            PlayGame();
        }
        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "IsFocused")
            {
                if (Element.IsFocused)
                {
                    // Navigation logic
                    IViewContainer <Xamarin.Forms.View> parentObject = null;
                    var parent = Element.Parent;
                    while (parent != null)
                    {
                        if (parent.Parent is IViewContainer <Xamarin.Forms.View> )
                        {
                            parent = parent.Parent;
                        }
                        else
                        {
                            parentObject = parent as IViewContainer <Xamarin.Forms.View>;
                            break;
                        }
                    }

                    if (parentObject != null)
                    {
                        var entries = GetChildren(parentObject);

                        if (entries.Count > 1)
                        {
                            Func <int> getFocusedIndex = () => entries.Select((v, i) => new
                            {
                                item  = v,
                                index = i
                            }).Where(w => w.item.IsFocused).Select(s => s.index).Single();

                            var focused = getFocusedIndex() + 1;
                            focused = focused + 1 > entries.Count ? 0 : focused;
                            if (focused > 0)
                            {
                                NextElement = entries.ElementAt(focused);
                                Control.SetImeActionLabel("Next", ImeAction.Next);
                            }
                            else
                            {
                                NextElement = null;
                                Control.SetImeActionLabel("Done", ImeAction.Done);
                            }
                        }
                        else
                        {
                            NextElement = null;
                            Control.SetImeActionLabel("Done", ImeAction.Done);
                        }
                    }
                }
            }
            base.OnElementPropertyChanged(sender, e);
        }
예제 #17
0
    public Controller()
    {
        //Prepare views
        inputView = new InputView();
        outputView = new OutputView();

        //Start input loop
        Start();
    }
예제 #18
0
 internal CommandConsole(LuaEnvironment lua, DrawingSizeF screenSize, GameApplication.OutputStreams streams, int maxLines = 500)
 {
     Debug.Assert(lua != null, "Lua environment can not be null");
     Debug.Assert(streams != null, "Streams can not be null");
     _streams = streams;
     _lua = lua;
     _outputView = ToDispose<OutputView>(new OutputView(screenSize));
     _inputView = ToDispose<InputView>(new InputView(_outputView));
 }
예제 #19
0
        public void UpdateValues()
        {
            if (!IsHandleCreated || IsDisposed)
            {
                return;
            }

            InputView.Invalidate();
        }
예제 #20
0
        private void StartUp()
        {
            OutputView.ShowStartScreen();
            int i;

            while ((i = InputView.readLevelInput()) == 0)
            {
            }
            ReadLevel(i);
        }
예제 #21
0
        public override View OnCreateCandidatesView()
        {
            View v = LayoutInflater.Inflate(Resource.Layout.Input, null);

            InputView inputView = (InputView)v.FindViewById(Resource.Id.inputView);

            inputView.ActionChosen += OnActionChosen;

            return(v);
        }
 public MainController()
 {
     game = new Game();
     new MapCreator(game);
     inputView       = new InputView(game);
     outputView      = new OutputView(game);
     CountDownThread = new Thread(CountDown);
     CountDownThread.Start();
     Console.ReadLine();
 }
예제 #23
0
        public GameController()
        {
            _outputView = new OutputView();
            _inputView  = new InputView();
            LevelReader p = new LevelReader();

            _maze = p.ReadFile(AskLevel());
            _outputView.PrintMaze(_maze.FirstTile);
            GameCycle();
        }
            protected override void Dispose(bool disposing)
            {
                if (disposing && InputView != null)
                {
                    InputView.Dispose();
                    InputView = null;
                }

                base.Dispose(disposing);
            }
예제 #25
0
        /* The ReturnButtonClick are what will
         * fire when the button on the UI is checked
         */
        private void ReturnButtonClick()
        {
            SubmitOrderButtonContent = "Submit";
            OnChnaged(nameof(SubmitOrderButtonContent));

            SubmitOrderButtonCommand = new RelayCommand(SubmitOrderButtonClick);
            OnChnaged(nameof(SubmitOrderButtonCommand));

            ContentControlBinding = new InputView();
            OnChnaged(nameof(ContentControlBinding));
        }
예제 #26
0
 public static void UpdateText(this TextBox platformControl, InputView inputView)
 {
     if (platformControl is MauiPasswordTextBox passwordBox)
     {
         passwordBox.Password = TextTransformUtilites.GetTransformedText(inputView.Text, passwordBox.IsPassword ? TextTransform.None : inputView.TextTransform);
     }
     else
     {
         platformControl.Text = TextTransformUtilites.GetTransformedText(inputView.Text, inputView.TextTransform);
     }
 }
예제 #27
0
 private void ResetInputView(InputView i)
 {
     i.SelectedField = 0;
     foreach (var inputField in i.Inputs)
     {
         inputField.Text                  = "";
         inputField.BackgroundColor       = i.DefaultBackgroundColor;
         inputField.SelectBackgroundColor = i.DefaultSelectBackgroundColor;
         inputField.SelectIndex           = 0;
         inputField.RenderStart           = 0;
     }
 }
예제 #28
0
 protected void RequestFocus(InputView input)
 {
     if (Device.RuntimePlatform == Device.iOS)
     {
         input.Focus();
         return;
     }
     Task.Run(async() =>
     {
         await Task.Delay(AndroidShowModalAnimationDelay);
         Device.BeginInvokeOnMainThread(() => input.Focus());
     });
 }
예제 #29
0
        public SessionContext(ContextManager manager, BankNetInteractor interactor) : base(manager, "Session", "Common")
        {
            this.interactor = interactor;
            scheduleDestroy = !interactor.IsLoggedIn;

            if (!scheduleDestroy)
            {
                RegisterAutoHide("account_create", "account_info", "password_update", "exit_prompt", "account_show", "transfer");


                // XML-generated views
                options        = GetView <ListView>("menu_options");
                options_exit   = options.GetView <ButtonView>("exit");
                options_view   = options.GetView <ButtonView>("view");
                options_delete = options.GetView <ButtonView>("delete");
                options_tx     = options.GetView <ButtonView>("tx");
                options_update = options.GetView <ButtonView>("update");
                options_add    = options.GetView <ButtonView>("add");

                exit_prompt     = GetView <DialogView>("exit_prompt");
                password_update = GetView <InputView>("password_update");
                transfer        = GetView <InputView>("transfer");
                account_delete  = GetView <DialogView>("account_delete");
                account_create  = GetView <InputView>("account_create");
                success         = GetView <DialogView>("Success");


                // Synthetic views
                accountTypes = GenerateList(
                    new string[] {
                    GetIntlString("SE_acc_checking"),
                    GetIntlString("SE_acc_saving")
                }, v =>
                {
                    accountType = accountTypes.SelectedView;
                    account_create.Inputs[1].Text = (v as ButtonView).Text;
                    CreateAccount();
                }, true);

                // Run setup
                SetupBackEvents();
                SetupHideEvents();
                SetupInputEvents();
                SetupSubmissionEvents();
                SetupDefaultViewStates();

                // We have a valid context!
                RefreshUserInfo();      // Get user info
                RefreshAccountList();   // Get account list for user
            }
        }
예제 #30
0
 private void Test2ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FuzzyApp.Initalize();
     variable1.ClearVariable();
     InputView.Clear();
     OutputView.Clear();
     FuzzyApp.defaultSettings2();
     if (FuzzyApp.InputVariables.Count > 0)
     {
         variable1.Current = FuzzyApp.InputVariables[0];
         variable1.Populate();
         populateVariables();
     }
 }
예제 #31
0
        public async Task <object> ShowInputDialog(string prompt, string hostName, string defaultValue = null)
        {
            _viewModelLocator.InputViewModel.Prompt = prompt;
            _viewModelLocator.InputViewModel.Name   = defaultValue;

            InputView inputDialog = new InputView
            {
                DataContext = _viewModelLocator.InputViewModel
            };

            object input = await DialogHost.Show(inputDialog, hostName);

            return(input);
        }
예제 #32
0
 public MainController()
 {
     _outputView = new OutputView();
     _outputView.PrintWelcomeMessage();
     _inputView        = new InputView();
     _parser           = new Parser();
     _outputView.Print = _parser.BuildMaze();
     _route            = _parser.Route;
     mainThread        = new Thread(new ThreadStart(Run));
     mainThread.Start();
     SwitchInput();
     mainThread.Interrupt();
     _outputView.WriteEndGameMessage(_route.Score);
     Console.ReadLine();
 }
예제 #33
0
        public void Navigate(ViewType viewType, Person person)
        {
            if (!ViewsDictionary.ContainsKey(viewType))
            {
                InitializeView(viewType);
            }
            ContentOwner.ContentControl.Content = ViewsDictionary[viewType];

            InputView      tempView  = (InputView)ViewsDictionary[viewType];
            InputViewModel tempModel = (InputViewModel)tempView.DataContext;

            tempModel.ButtonName = "Change";
            tempModel.Person     = new Person(person.FirstName, person.LastName, person.Email, person.BirthDate);
            ;
        }