public void OnDeleteVehicle(Vehicle item, Vehicle[] numerable)
        {
            Action a = () =>
            {
                if (Client.IsLogin())
                {
                    SearchVehicle.ComplectSearchObject(numerable.ToList());
                    Items.UpdateAVehicle(SearchVehicle.GetItemSearched());
                    Items.UpdateAVehicleHeader(SearchVehicle.GetItemSearched());
                    Items.UpdateVehicle(SearchVehicle.GetItemSearched());
                }

                if (VehicleEdit.Dialog.Item.VIN == item.VIN && VehicleEdit.Dialog.Visibility == System.Windows.Visibility.Visible)
                {
                    VehicleEdit.Dialog.Hide();
                }

                if (Client.Vehicle.VIN == item.VIN)
                {
                    Items.UpdateMainPage();
                }

                if (Items.ucVehicle.VehicleGrid.Visibility == System.Windows.Visibility.Visible && Items.ucVehicle.Vehicle.VIN == item.VIN)
                {
                    Items.ucVehicle.VehicleGrid.Visibility = System.Windows.Visibility.Hidden;
                    Items.ucVehicle.Vehicle.VIN            = "null";
                }
            };

            System.Windows.Application.Current.Dispatcher.BeginInvoke(a);
        }
Beispiel #2
0
        public static void SetActiveUser(User item)
        {
            User = item;

            //Items.mainWindow.
            Items.mainWindow.Title = $"{item.Login} - Головне вікно";
            Items.UpdateMainPage();
            Items.UpdateMenuButtons();

            Vehicle[] numerableVehicle = Server.ConnectProvider.SendAllVehicle();

            SearchVehicle.ClearSearchFields();
            SearchVehicle.ComplectSearchObject(numerableVehicle.ToList());
            Items.UpdateAVehicle(SearchVehicle.GetItemSearched());
            Items.UpdateVehicle(SearchVehicle.GetItemSearched());
            Items.UpdateAVehicleHeader(numerableVehicle.ToList());

            User[]      numerableUser     = Server.ConnectProvider.SelectAllUser();
            List <User> sortedApplication = (from i in numerableUser where i.Status != 0 && i.Status != 1 select i).ToList();

            Items.UpdateAUser(Items.ucAUser.SearchAsLogin(sortedApplication));
            Items.UpdateAUserHeader(numerableUser.ToList());

            Items.ucStatistic.SetStatisticPage(UCPage.StatisticPage.Year);
        }
        public void OnAddVehicle(Vehicle item, Vehicle[] numerable)
        {
            Action a = () =>
            {
                if (Client.IsLogin())
                {
                    SearchVehicle.ComplectSearchObject(numerable.ToList());
                    Items.UpdateAVehicle(SearchVehicle.GetItemSearched());
                    Items.UpdateAVehicleHeader(SearchVehicle.GetItemSearched());
                    Items.UpdateVehicle(SearchVehicle.GetItemSearched());
                }
            };

            System.Windows.Application.Current.Dispatcher.BeginInvoke(a);
        }