Exemple #1
0
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {
            //  string msg = "";
            int msg = 0;

            /*
             * if ((bool)tgl_printOnSavePur.IsChecked)
             * {
             *  print_on_save_purrow.value = "1";
             *
             * }
             * else
             * {
             *  print_on_save_purrow.value = "0";
             * }
             */
            if ((bool)tgl_printOnSaveSale.IsChecked)
            {
                print_on_save_salerow.value = "1";
            }
            else
            {
                print_on_save_salerow.value = "0";
            }

            /*
             * if ((bool)tgl_emailOnSavePur.IsChecked)
             * {
             *  email_on_save_purrow.value = "1";
             *
             * }
             * else
             * {
             *  email_on_save_purrow.value = "0";
             * }
             */
            if ((bool)tgl_emailOnSaveSale.IsChecked)
            {
                email_on_save_salerow.value = "1";
            }
            else
            {
                email_on_save_salerow.value = "0";
            }
            //msg = await setvalueModel.Save(print_on_save_purrow);
            msg = await setvalueModel.Save(print_on_save_salerow);

            //msg = await setvalueModel.Save(email_on_save_purrow);
            msg = await setvalueModel.Save(email_on_save_salerow);


            await Getprintparameter();

            await FillCombo.Getprintparameter();

            if (msg > 0)
            {
                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                await Task.Delay(1500);

                this.Close();
            }

            else
            {
                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
            }
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_mainGrid);
                }
                //windowFlowDirection();
                menuList = new List <string> {
                    "applications", "sales", "reports",
                    "sectionData", "settings"
                };

                translate();

                #region loading
                loadingList = new List <keyValueBool>();
                bool isDone = true;
                loadingList.Add(new keyValueBool {
                    key = "loading_getGroupObjects", value = false
                });
                //loadingList.Add(new keyValueBool { key = "loading_getUserPath", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getTax", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getDateForm", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getRegionAndCurrency", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getStorageCost", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getAccurac", value = false });
                loadingList.Add(new keyValueBool {
                    key = "loading_getUserPersonalInfo", value = false
                });
                //loadingList.Add(new keyValueBool { key = "loading_getDefaultSystemInfo", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getItemUnitsUsers", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_getprintSitting", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_GlobalItemUnitsList", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_GlobalUnitsList", value = false });
                //loadingList.Add(new keyValueBool { key = "loading_POSList", value = false });

                await FillCombo.loading_getDefaultSystemInfo();

                await FillCombo.Getprintparameter();

                loading_getGroupObjects();
                await FillCombo.RefreshCountry();

                FillCombo.fillRegion();
                //loading_getUserPath();
                //loading_getTax();
                //loading_getDateForm();
                //loading_getRegionAndCurrency();
                //loading_getStorageCost();
                //loading_getAccurac();
                //loading_getItemUnitsUsers();
                loading_getUserPersonalInfo();
                //loading_getDefaultSystemInfo();
                //loading_getprintSitting();
                //loading_GlobalItemUnitsList();
                //loading_GlobalUnitsList();
                //loading_POSList();

                do
                {
                    isDone = true;
                    foreach (var item in loadingList)
                    {
                        if (item.value == false)
                        {
                            isDone = false;
                            break;
                        }
                    }
                    if (!isDone)
                    {
                        //MessageBox.Show("not done");
                        //string s = "";
                        //foreach (var item in loadingList)
                        //{
                        //    s += item.name + " - " + item.value + "\n";
                        //}
                        //MessageBox.Show(s);
                        await Task.Delay(0500);

                        //MessageBox.Show("do");
                    }
                }while (!isDone);
                #endregion

                if (MainWindow.userLogin.type == "ag")
                {
                    btn_applications.Visibility = Visibility.Collapsed;
                    btn_sectionData.Visibility  = Visibility.Collapsed;
                    btn_settings.Visibility     = Visibility.Collapsed;

                    Btn_sales_Click(btn_sales, null);
                }
                else
                {
                    Btn_applications_Click(btn_applications, null);
                }
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_mainGrid);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_mainGrid);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }