Esempio n. 1
0
 private void EditProgram(object sender)
 {
     if (OnEdit != null)
     {
         OnEdit.Invoke(sender as TV_Card);
     }
 }
        public static void EditMessage(string[] splited)
        {
            if (splited.Length < 5)
            {
                return;
            }
            if (!int.TryParse(splited[1], out var sessionId) || !int.TryParse(splited[2], out var senderId) || !int.TryParse(splited[4], out var messageId))
            {
                return;
            }
            var     fromMe = Id == senderId;
            Message mess   = null;

            if (fromMe)
            {
                int idx = Contacts[sessionId].Messages.FindIndex((item) => item.Id == messageId);
                mess = Contacts[sessionId].Messages[idx];
            }
            else
            {
                int idx = Contacts[senderId].Messages.FindIndex((item) => item.Id == messageId);
                mess = Contacts[senderId].Messages[idx];
            }

            mess._rawMessage = splited[3];

            OnEdit?.Invoke(mess, sessionId, senderId);
        }
Esempio n. 3
0
 private void ContextEdit_Click(object sender, RoutedEventArgs e)
 {
     if (OnEdit != null)
     {
         OnEdit.Invoke(this);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// This event is called every time that the user clicks on some cell in the grid.
        /// The Img Mouse Down is called first, determining what action caused the event.
        /// If it was caused by a click on some information, no action should be taken.
        /// </summary>
        private void BasicGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (action != Action.None)
            {
                if (CurrentItem != null)
                {
                    switch (action)
                    {
                    case Action.Edit:
                        OnEdit?.Invoke(CurrentItem);
                        break;

                    case Action.Delete:
                        OnDelete?.Invoke(CurrentItem);
                        break;

                    default:
                        break;
                    }
                }
            }

            action       = Action.None;
            SelectedItem = null;
        }
Esempio n. 5
0
        public void Run()
        {
//        public async Task Run() {
//        public async Run() { // error CS0246
//        public async Task Run() {
//            await OnEdit?.Invoke(this, EventArgs.Empty); // error CS4008: Cannot await 'void'
            OnEdit?.Invoke(this, EventArgs.Empty); // error CS4008: Cannot await 'void'
        }
Esempio n. 6
0
 private void TextBoxLostFocus(object sender, RoutedEventArgs e)
 {
     IsInEditMode = false;
     if (OnEdit != null)
     {
         OnEdit.Invoke(this, System.EventArgs.Empty);
     }
 }
Esempio n. 7
0
 /// <summary>
 /// release the edit mode when user presses enter.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.Windows.Input.KeyEventArgs"/> instance containing the event data.</param>
 private void TextBoxKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         IsInEditMode = false;
         if (OnEdit != null)
         {
             OnEdit.Invoke(this, System.EventArgs.Empty);
         }
     }
 }
        private async void OpenEditDialog()
        {
            var parameters = new DialogParameters
            {
                { "TaskData", TaskData }, { "InitId", await TaskService.GetParentIdList(TaskData.Id, TaskData.Type) }
            };
            var dialog = DialogService.Show <TaskDialog>("Edit Task", parameters);
            var result = await dialog.Result;

            if (!result.Cancelled)
            {
                await OnEdit.InvokeAsync();
            }
        }
Esempio n. 9
0
        public void OpenEdit(ReplaceModel replaceModel)
        {
            if (Edit)
            {
                var res =
                    !ReplaceModel.ItemNo.Equals(ItemNo.Text, StringComparison.CurrentCultureIgnoreCase) ||
                    !ReplaceModel.ReplaceNo.Equals(ReplaceNo.Text, StringComparison.CurrentCultureIgnoreCase)
                        ? MessageBox.Show("Вы уже редактируете запись. Сохранить изменения предидущей?",
                                          "Сохранить изменения", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
                        : DialogResult.No;
                switch (res)
                {
                case DialogResult.Yes:
                    OnEdit?.Invoke(ReplaceModel, new ReplaceModel()
                    {
                        ItemNo    = ItemNo.Text.ToUpperInvariant(),
                        ReplaceNo = ReplaceNo.Text.ToUpperInvariant()
                    });
                    break;

                case DialogResult.No:
                    ReplaceModel   = replaceModel;
                    ItemNo.Text    = ReplaceModel.ItemNo.ToUpperInvariant();
                    ReplaceNo.Text = ReplaceModel.ReplaceNo.ToUpperInvariant();
                    break;

                case DialogResult.Cancel:

                    break;
                }
            }
            else
            {
                ReplaceModel   = replaceModel;
                ItemNo.Text    = ReplaceModel.ItemNo.ToUpperInvariant();
                ReplaceNo.Text = ReplaceModel.ReplaceNo.ToUpperInvariant();
            }

            Edit = true;
        }
Esempio n. 10
0
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     if (Edit)
     {
         OnEdit?.Invoke(ReplaceModel, new ReplaceModel()
         {
             ItemNo    = ItemNo.Text.ToUpperInvariant(),
             ReplaceNo = ReplaceNo.Text.ToUpperInvariant()
         });
         Edit = false;
         ClearFields();
     }
     else
     {
         OnAdd?.Invoke(new ReplaceModel()
         {
             ItemNo    = ItemNo.Text.ToUpperInvariant(),
             ReplaceNo = ReplaceNo.Text.ToUpperInvariant()
         });
         ClearFields();
     }
 }
Esempio n. 11
0
 public void Run()
 {
     OnEdit?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 12
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
        }
Esempio n. 13
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
        }
Esempio n. 14
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
        }
Esempio n. 15
0
 private void EditClick(UIComponent component, UIMouseEventParameter eventParam) => OnEdit?.Invoke();
 public void Run()
 {
     OnEdit?.Invoke(this, new EditEventArgs("test.txt"));
 }
Esempio n. 17
0
 protected void HandleEdit(TItem item)
 {
     OnEdit.InvokeAsync(item);
 }
Esempio n. 18
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     btn_save.Enabled = false;
     OnEdit?.Invoke(this);
 }
Esempio n. 19
0
 protected void OnEdited(object sender, RoutedEventArgs routedEventArgs)
 {
     OnEdit?.Invoke(true);
 }
Esempio n. 20
0
 private void BtnEditBird_Click(object sender, EventArgs e)
 {
     OnEdit.Invoke(this, new OnEditEventArgs(birdId, birdName, count));
     this.Dismiss();
 }
Esempio n. 21
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            int TagIdx = (int)Tag;

            OnEdit?.Invoke(TagIdx);
        }
Esempio n. 22
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     OnEdit?.Invoke(this, new EditStrategyEventArgs(_tradeSettings));
 }