示例#1
0
        private void ProcessInput(Terminal terminal)
        {
            foreach (var keyEvent in terminal.KeyEvents)
            {
                switch (keyEvent.Code)
                {
                    case KeyCode.Up:
                        --SelectedIndex;
                        terminal.Audio.Play(Sounds.HighBeep);
                        break;

                    case KeyCode.Down:
                        ++SelectedIndex;
                        terminal.Audio.Play(Sounds.HighBeep);
                        break;

                    case KeyCode.Escape:
                        terminal.Audio.Play(Sounds.HighBeep);
                        OnBack?.Invoke();
                        break;

                    default:
                        Items?[SelectedIndex]?.HandleKeyEvent(terminal, keyEvent);
                        break;
                }
            }
        }
        protected override void Start()
        {
            base.Start();

            _btnBack.onClick.AddListener(() =>
            {
                OnBack?.Invoke();
            });
        }
示例#3
0
 private async void OnBackClick(MouseEventArgs eventArgs)
 {
     if (OnBack.HasDelegate)
     {
         await OnBack.InvokeAsync(eventArgs);
     }
     else
     {
         await JsInvokeAsync("history.back");
     }
 }
示例#4
0
        private void Update()
        {
#if UNITY_ANDROID || UNITY_EDITOR
            if (UnityEngine.Input.GetKey(KeyCode.Escape) && !backPressed)
            {
                OnBack?.Invoke();
            }
            if (UnityEngine.Input.GetKeyUp(KeyCode.Escape) && backPressed)
            {
                backPressed = false;
            }
#endif
        }
示例#5
0
        void Awake()
        {
            m_BackButton.onClick.AddListener(() =>
            {
                OnBack?.Invoke();
            });

            m_RestartButton.onClick.AddListener(() =>
            {
                OnRestart?.Invoke();
            });

            m_MainMenu.onClick.AddListener(() =>
            {
                OnMainMenu?.Invoke();
            });
        }
示例#6
0
    public virtual void Hide()
    {
        if (m_di > 0 && Module_Global.instance)
        {
            var i = m_di; m_di = 0;
            Module_Global.instance.ShowItemDecomposeInfo(i, m_dp, m_dc, () => Hide());
            return;
        }

        if (parentTween)
        {
            parentTween.PlayReverse();
        }
        if (effect)
        {
            effect.PlayReverse();
        }

        onHide?.Invoke();
        OnBack?.Invoke();
    }
示例#7
0
 private void AllClipsFragment_Click1(object sender, EventArgs e)
 {
     OnBack?.Invoke();
 }
 public virtual void Back() => OnBack?.Invoke(null);
示例#9
0
 private void OnBackButton_Clicked()
 {
     OnBack?.Invoke();
     PlayBackSound();
 }
示例#10
0
        private void InitControls()
        {
            #region Set Data
            string type          = ConfigurationManager.AppSettings["interfaceType"];
            int    interfaceMode = 0;
            if (type != null)
            {
                if (type.Equals("wpf"))
                {
                    interfaceMode = 0;
                }
                else
                {
                    interfaceMode = 1;
                }
            }
            #endregion
            #region Manage User Fields
            var appInterfaceLabel = new Label("Tryb aplikacji")
            {
                X = Pos.Center(),
                Y = 1,
            };
            Add(appInterfaceLabel);
            ustring[] radioElements      = new ustring[] { "Graficzny", "Konsolowy" };
            var       radioInterfaceType = new RadioGroup(radioElements, interfaceMode)
            {
                X = 1,
                Y = Pos.Top(appInterfaceLabel)
            };
            Add(radioInterfaceType);

            #endregion


            #region Button
            var saveButton = new Button("Zapisz")
            {
                X = Pos.Center() - 10,
                Y = Pos.Percent(100) - 3
            };
            Add(saveButton);
            var backButton = new Button("Cofnij")
            {
                X = Pos.Center() + 3,
                Y = Pos.Percent(100) - 3
            };
            Add(backButton);
            #endregion

            #region bind-button-events
            saveButton.Clicked += () =>
            {
                OnSave?.Invoke(radioInterfaceType.SelectedItem);
            };

            backButton.Clicked += () =>
            {
                OnBack?.Invoke();
                Close();
            };
            #endregion
        }
示例#11
0
 public void OnBackButtonClick()
 {
     OnBack?.Invoke();
 }
示例#12
0
 private void Back_OnClick(object sender, RoutedEventArgs e)
 => OnBack?.Invoke(this, EventArgs.Empty);
示例#13
0
 private void btnBack_Click(object sender, RoutedEventArgs e)
 {
     OnBack?.Invoke(this, new EventArgs());
 }
示例#14
0
 private async void OnBackClicked(object sender, EventArgs e)
 {
     await OnBack?.Invoke(sender, e);
 }
示例#15
0
        private void InitControls()
        {
            #region Init Elements
            var userList = new ListView(source: users)
            {
                Y      = 1,
                X      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 5,
            };
            Add(userList);

            var editButton = new Button("Edytuj")
            {
                X = Pos.Center() - 6,
                Y = Pos.Percent(100) - 3
            };
            Add(editButton);

            var addButton = new Button("Usuń")
            {
                X = Pos.Center() - 20,
                Y = Pos.Percent(100) - 3
            };
            Add(addButton);


            var deleteButton = new Button("Usuń")
            {
                X = Pos.Center() + 8,
                Y = Pos.Percent(100) - 3
            };
            Add(deleteButton);

            var backButton = new Button("Cofnij")
            {
                X = Pos.Center() - 6,
                Y = Pos.Percent(100) - 1
            };
            Add(backButton);

            #endregion
            userList.FocusFirst();
            userList.OpenSelectedItem += (a) =>
            {
                var tempUser = users[userList.SelectedItem];
                MessageBox.Query(25, 11, "Szczegóły", $"Nazwa użytkownika: {tempUser.UserName}\nEmail: {tempUser.Email}\nNumer Telefonu: {tempUser.Phone}\nUlica: {tempUser.Adres1}\nMiejscowość: {tempUser.Adres2}\nKod pocztowy: {tempUser.Adres3}\nStatus: {Controller.HelpMethods.GetEnumDescription(tempUser.Rola)}", "Ok");
                return;
            };

            #region button operation
            addButton.Clicked += () =>
            {
                OnAdd?.Invoke();
            };

            editButton.Clicked += () =>
            {
                OnEdit?.Invoke(users[userList.SelectedItem]);
            };

            deleteButton.Clicked += () =>
            {
                var n = MessageBox.Query(25, 8, "Usuń", "Czy napewno chcesz usunąć wybranego użytkownika?", "Anuluj", "Ok");
                if (n == 1)
                {
                    OnRemove?.Invoke(users[userList.SelectedItem].UserId);
                }
            };

            backButton.Clicked += () =>
            {
                OnBack?.Invoke();
            };

            #endregion
        }
示例#16
0
        private void InitControls()
        {
            var carList = new ListView(source: cars)
            {
                Y      = 1,
                X      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 5,
            };

            Add(carList);

            var reservButton = new Button("Zarezerwuj wybrany samochód", true)
            {
                X = Pos.Center(),
                Y = Pos.Percent(100) - 3
            };


            var dateShowButton = new Button("Sprawdź terminy")
            {
                X = Pos.Left(reservButton) - 25,
                Y = Pos.Percent(100) - 3
            };


            var detailsButton = new Button("Dane Szczegółowe")
            {
                X = Pos.Right(reservButton) + 5,
                Y = Pos.Percent(100) - 3
            };



            var editButton = new Button("Edytuj")
            {
                X = Pos.Center(),
                Y = Pos.Percent(100) - 2
            };

            var addButton = new Button("Dodaj")
            {
                X = Pos.Left(editButton) - 15,
                Y = Pos.Percent(100) - 2
            };

            var deleteButton = new Button("Usuń")
            {
                X = Pos.Right(editButton) + 5,
                Y = Pos.Percent(100) - 2
            };

            if (user.Rola == Model.UserRole.User)
            {
                Add(reservButton);
                Add(dateShowButton);
                Add(detailsButton);
            }

            if (user.Rola == Model.UserRole.Staff || user.Rola == Model.UserRole.Admin)
            {
                Add(editButton);
                Add(addButton);
                Add(deleteButton);
            }


            var backButton = new Button("Cofnij")
            {
                X = Pos.Center() - 5,
                Y = Pos.Percent(100) - 1
            };

            Add(backButton);


            //carList.OpenSelectedItem += (a) =>
            //{
            //    carList.FocusNext();
            //    var tempCar = cars[carList.SelectedItem];
            //    MessageBox.Query(25, 11, "Szczegóły", $"Model: {tempCar.Model}\nKolor: {tempCar.CarColor}\nMoc: {tempCar.CarPower}\nSzkrzynia Biegów: {Controller.HelpMethods.GetEnumDescription(tempCar.Gearbox)}\nSilnik: {Controller.HelpMethods.GetEnumDescription(tempCar.Engine)}\nKosz wypożyczenia: {tempCar.CarDayPrince} PLN/Dzień\nKaucja: {tempCar.CarBail} PLN\nObecny Status: {Controller.HelpMethods.GetEnumDescription(tempCar.Status)}", "Ok");
            //};

            #region bind-button-events
            detailsButton.Clicked += () =>
            {
                var tempCar = cars[carList.SelectedItem];
                MessageBox.Query(25, 11, "Szczegóły", $"Model: {tempCar.Model}\nKolor: {tempCar.CarColor}\nMoc: {tempCar.CarPower}\nSzkrzynia Biegów: {Controller.HelpMethods.GetEnumDescription(tempCar.Gearbox)}\nSilnik: {Controller.HelpMethods.GetEnumDescription(tempCar.Engine)}\nKosz wypożyczenia: {tempCar.CarDayPrince} PLN/Dzień\nKaucja: {tempCar.CarBail} PLN\nObecny Status: {Controller.HelpMethods.GetEnumDescription(tempCar.Status)}", "Ok");
            };

            editButton.Clicked += () =>
            {
                OnEdit?.Invoke(cars[carList.SelectedItem]);
            };

            addButton.Clicked += () =>
            {
                OnAdd?.Invoke();
            };

            deleteButton.Clicked += () =>
            {
                var n = MessageBox.Query(25, 8, "Usuń", "Czy napewno chcesz usunąć wybrany samochód?", "Anuluj", "Ok");
                if (n == 1)
                {
                    OnRemove?.Invoke(cars[carList.SelectedItem].CarId);
                }
                cars.Remove(cars[carList.SelectedItem]);
            };

            reservButton.Clicked += () =>
            {
                OnReservation?.Invoke(cars[carList.SelectedItem]);
            };

            backButton.Clicked += () =>
            {
                OnBack?.Invoke();
            };

            dateShowButton.Clicked += () =>
            {
                var dateWindow = new Window("Zajęte Terminy")
                {
                    Width  = Dim.Percent(75),
                    Height = Dim.Percent(50),
                    Y      = Pos.Center(),
                    X      = Pos.Center(),
                };
                Add(dateWindow);
                var dateExitButton = new Button("Zamknij")
                {
                    X = Pos.Center(),
                    Y = Pos.Percent(100) - 2,
                };
                dateWindow.Add(dateExitButton);
                var dateList = new ListView()
                {
                    Width  = Dim.Fill(),
                    Height = Dim.Fill() - 3,
                };
                dateWindow.Add(dateList);
                dateList.SetSource(myController.manageReservation.GetCarReservationDates(cars[carList.SelectedItem].CarId));
                dateExitButton.Clicked += () =>
                {
                    Remove(dateWindow);
                };
            };
            #endregion
        }
示例#17
0
        private void InitControls()
        {
            #region Init Elements
            var reservationList = new ListView(source: reservations)
            {
                Y      = 1,
                X      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 5,
            };
            Add(reservationList);

            var editButton = new Button("Edytuj")
            {
                X = Pos.Center() - 6,
                Y = Pos.Percent(100) - 3
            };
            Add(editButton);

            var addButton = new Button("Dodaj")
            {
                X = Pos.Center() - 20,
                Y = Pos.Percent(100) - 3
            };
            Add(addButton);


            var deleteButton = new Button("Usuń")
            {
                X = Pos.Center() + 8,
                Y = Pos.Percent(100) - 3
            };
            Add(deleteButton);

            var backButton = new Button("Cofnij")
            {
                X = Pos.Center() - 6,
                Y = Pos.Percent(100) - 1
            };
            Add(backButton);

            #endregion
            reservationList.FocusFirst();
            reservationList.OpenSelectedItem += (a) =>
            {
                var tempReservation = reservations[reservationList.SelectedItem];
                MessageBox.Query(25, 12, "Szczegóły", $"Użytkownik: {tempReservation.User}\nSamochód: {tempReservation.Car}\nData od: {tempReservation.DateFrom}\nData do: {tempReservation.DateTo}\nUwagi: {tempReservation.Comments}\nKoszt: {tempReservation.Cost} PLN\nKaucja: {tempReservation.Car.CarBail} PLN\nStatus: {Controller.HelpMethods.GetEnumDescription(tempReservation.Status)}", "Ok");
                return;
            };

            #region button operation
            addButton.Clicked += () =>
            {
                OnAdd?.Invoke();
            };

            editButton.Clicked += () =>
            {
                OnEdit?.Invoke(reservations[reservationList.SelectedItem]);
            };

            deleteButton.Clicked += () =>
            {
                var n = MessageBox.Query(25, 8, "Usuń", "Czy napewno chcesz usunąć wybraną rezerwację?", "Anuluj", "Ok");
                if (n == 1)
                {
                    OnRemove?.Invoke(reservations[reservationList.SelectedItem].ReservationId);
                    reservations.Remove(reservations[reservationList.SelectedItem]);
                }
            };

            backButton.Clicked += () =>
            {
                OnBack?.Invoke();
            };

            #endregion
        }
示例#18
0
        private void InitControls()
        {
            #region Fields
            var userSecionLabel = new Label(1, 1, "Rezerwacja:");
            Add(userSecionLabel);
            var dateFromLabel = new Label("Data od:")
            {
                X = Pos.Left(userSecionLabel),
                Y = Pos.Top(userSecionLabel) + 1,
            };
            Add(dateFromLabel);

            var fromTime = new TimeField()
            {
                X = Pos.Left(dateFromLabel),
                Y = Pos.Top(dateFromLabel) + 1,
            };
            Add(fromTime);

            var fromDate = new DateField()
            {
                X = Pos.Right(fromTime) + 5,
                Y = Pos.Top(fromTime),
            };
            Add(fromDate);

            var dateToLabel = new Label("Data do:")
            {
                X = Pos.Left(fromTime),
                Y = Pos.Top(fromTime) + 1,
            };
            Add(dateToLabel);

            var toTime = new TimeField()
            {
                X = Pos.Left(dateToLabel),
                Y = Pos.Top(dateToLabel) + 1,
            };
            Add(toTime);

            var toDate = new DateField()
            {
                X = Pos.Right(toTime) + 5,
                Y = Pos.Top(toTime),
            };
            Add(toDate);

            var commentsLabel = new Label("Uwagi:")
            {
                X = Pos.Left(toTime),
                Y = Pos.Top(toTime) + 1,
            };
            Add(commentsLabel);
            var commentsText = new TextField("")
            {
                X     = Pos.Left(commentsLabel),
                Y     = Pos.Top(commentsLabel) + 1,
                Width = Dim.Fill()
            };
            Add(commentsText);

            var carLabel = new Label("Samochód:")
            {
                X = Pos.Left(commentsText),
                Y = Pos.Top(commentsText) + 1,
            };
            Add(carLabel);

            var carList = new ListView()
            {
                X      = Pos.Left(carLabel),
                Y      = Pos.Top(carLabel) + 1,
                Width  = Dim.Fill(),
                Height = 5
            };
            carList.SetSource(cars);
            Add(carList);

            var datewLabel = new Label("Zajęte terminy:")
            {
                X = Pos.Left(carList),
                Y = Pos.Top(carList) + 6,
            };
            Add(datewLabel);

            var dateList = new ListView()
            {
                X      = Pos.Left(datewLabel),
                Y      = Pos.Top(datewLabel) + 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 5,
            };
            Add(dateList);
            #endregion


            #region Button
            var saveButton = new Button("Rezerwuj", true)
            {
                X = Pos.Center() - 20,
                Y = Pos.Percent(100) - 2,
            };
            Add(saveButton);

            var backButton = new Button("Anuluj")
            {
                X = Pos.Center() + 5,
                Y = Pos.Top(saveButton)
            };
            Add(backButton);
            #endregion

            carList.SelectedItemChanged += (a) =>
            {
                dateList.SetSource(controller.manageReservation.GetCarReservationDates(cars[carList.SelectedItem].CarId));
            };

            #region Set Data
            if (selectedCar != null)
            {
                carList.SelectedItem = cars.FindIndex(c => c.CarId == selectedCar.CarId);
            }
            #endregion

            fromTime.Time = DateTime.Now.TimeOfDay;
            fromDate.Date = DateTime.Now;
            toTime.Time   = DateTime.Now.TimeOfDay;
            toDate.Date   = DateTime.Now.AddDays(3);

            #region bind-button-events
            saveButton.Clicked += () =>
            {
                if (string.IsNullOrEmpty(commentsText.Text.ToString()))
                {
                    MessageBox.ErrorQuery(25, 8, "Błąd", "Pole uwagi nie może być puste.", "Ok");
                    return;
                }
                var dateFrom = fromDate.Date.Date + fromTime.Time;
                var dateTo   = toDate.Date.Date + toTime.Time;
                if (dateFrom > dateTo)
                {
                    MessageBox.ErrorQuery(25, 8, "Błąd", "Data rozpoczęcia musi być mniejsza niż data zakończenia.", "Ok");
                    return;
                }
                if (dateFrom < DateTime.Now)
                {
                    MessageBox.ErrorQuery(25, 8, "Błąd", "Data rozpoczęcia musi być większa od obecnej daty.", "Ok");
                    return;
                }
                Model.Reservation newReservationData = new Model.Reservation()
                {
                    DateFrom = dateFrom,
                    DateTo   = dateTo,
                    Comments = commentsText.Text.ToString(),
                    Status   = (int)Model.ReservationStatus.Verification,
                    User     = user,
                    Car      = cars[carList.SelectedItem]
                };
                OnSave?.Invoke(newReservationData);
            };

            backButton.Clicked += () =>
            {
                OnBack?.Invoke();
                Close();
            };
            #endregion
        }
示例#19
0
    private void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            OnBack?.Invoke();
        }

        if (Input.touchCount > 0)
        {
            if (Input.touchCount == 1)
            {
                trackedFinger1 = Input.GetTouch(0);

                if (trackedFinger1.phase == TouchPhase.Began)
                {
                    startPoint  = trackedFinger1.position;
                    gestureTime = 0.0f;
                }
                else if (trackedFinger1.phase == TouchPhase.Ended)
                {
                    if (lastTapTime <= _doubleTapProperty.MaxTapTimeDistance)
                    {
                        if (startPoint.x < Screen.width - 640 || startPoint.y > 230)
                        {
                            FireDoubleTapEvent();
                        }
                    }
                    else
                    {
                        endPoint = trackedFinger1.position;

                        float currentTapDistance  = Vector2.Distance(startPoint, endPoint);
                        float approvedTapDistance = _tapProperty.TapMaxDistance * Screen.dpi;

                        if (gestureTime <= _tapProperty.TapTime &&
                            currentTapDistance < approvedTapDistance)
                        {
                            FireTapEvent();
                        }


                        if (gestureTime <= _swipeProperty.swipeTime &&
                            Vector2.Distance(startPoint, endPoint) >= _swipeProperty.minSwipeDistance * Screen.dpi)
                        {
                            FireSwipeEvent();
                        }
                    }

                    lastTapTime = 0;
                }
                else
                {
                    gestureTime += Time.deltaTime;
                }
            }
            else
            {
                trackedFinger1 = Input.GetTouch(0);
                trackedFinger2 = Input.GetTouch(1);

                if (trackedFinger1.phase == TouchPhase.Moved && trackedFinger2.phase == TouchPhase.Moved &&
                    Vector2.Distance(trackedFinger1.position, trackedFinger2.position) <= _panProperty.MaxDistance * Screen.dpi)
                {
                    FirePanGesture();
                }
                else if (trackedFinger1.phase == TouchPhase.Moved || trackedFinger2.phase == TouchPhase.Moved)
                {
                    Vector2 prevPoint1 = GetPreviousPoint(trackedFinger1);
                    Vector2 prevPoint2 = GetPreviousPoint(trackedFinger2);

                    float currDistance = Vector2.Distance(trackedFinger1.position, trackedFinger2.position);
                    float prevDistance = Vector2.Distance(prevPoint1, prevPoint2);

                    if (Mathf.Abs(currDistance - prevDistance) >= _pinchProperty.MinDistanceChange * Screen.dpi)
                    {
                        FirePinchEvent(currDistance - prevDistance);
                    }
                }
            }
        }

        lastTapTime += Time.deltaTime;
    }