Esempio n. 1
0
        /// <summary>
        /// Converts the <see cref="MessageBoxResult"/> enum to its equivalent <see cref="MessageboxResponce"/> value.
        /// </summary>
        /// <param name="messageboxResult">
        /// The native message box result
        /// </param>
        /// <returns>
        /// The message box response
        /// </returns>
        private static MessageboxResponce GetMessageboxResponceFromResult(MessageBoxResult messageboxResult)
        {
            switch (messageboxResult)
            {
                case MessageBoxResult.Cancel:
                    return MessageboxResponce.Cancel;

                case MessageBoxResult.No:
                    return MessageboxResponce.No;

                case MessageBoxResult.None:
                    return MessageboxResponce.None;

                case MessageBoxResult.OK:
                    return MessageboxResponce.Ok;

                case MessageBoxResult.Yes:
                    return MessageboxResponce.Yes;

                default:
                    throw new ArgumentException(string.Format("Unsupported message box result '{0}'"), messageboxResult.ToString());
            }
        }
Esempio n. 2
0
        void deletebinfolder()
        {
            MessageBoxResult win = MessageBox.Show("When quaggan updates the bin folder 3rd party shaders like Reshade,GemFX and SweetFX will get removed!\n\nThis can solve problems with non functioning 3rd party shaders and launcher crashes.\n\nUpdate bin folder?", "Update Bin folder Info", MessageBoxButton.YesNo, MessageBoxImage.Question);

            try
            {
                if (win.ToString() == "Yes")
                {
                    if (Directory.Exists(exepath + "bin"))
                    {
                        Directory.Delete(exepath + "bin", true);
                    }
                    if (Directory.Exists(exepath + "bin64"))
                    {
                        Directory.Delete(exepath + "bin64", true);
                    }
                }
            }
            catch (Exception err) // logged
            {
                Log.Error("Unable to update bin folder", err);
                MessageBox.Show($"Quaggan couldn't update the bin folder! Foo!!!\nTechnical quaggan speech:{err}");
            }
        }
        private void ConvertToExcelButton_Click(object sender, RoutedEventArgs e)
        {
            bool conversionFinished = false;

            do
            {
                try
                {
                    ConvertMeasureToExcel();
                    conversionFinished = true;
                }
                catch (COMException ex)
                {
                    MessageBox.Show($"Plik szablonu nie został poprawnie załadowany\n\n{ ex.Message }", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    MessageBoxResult result = MessageBox.Show(
                        "Czy chcesz wczytać zewnętrzny plik szablonu?",
                        "Wczytaj szablon",
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Question);

                    if (result.ToString() == "Yes")
                    {
                        _templatePath = FileNamesCollector.GetTemplateFromDialog();
                    }
                    else
                    {
                        MessageBox.Show("Applikacja zostanie zamknięta.", "Zamkanie aplikacji...", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Wystąpił błąd\n{ ex.Message }\n\nApplikacja zostanie zamknięta", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    conversionFinished = true;
                }
            } while (conversionFinished);
        }
 public static void RemovePlugin(IPlugin pluginentry)
 {
     PluginContracts.PluginInfo plugininfo = pluginentry.PluginInfo;
     foreach (Plugin_Wrapper plugin in InstalledPlugins.Where(x => x.Plugin.PluginInfo == plugininfo))
     {
         if (plugin.Plugin.Uninstall())
         {
             UninstallPlugin(pluginentry);
         }
         else
         {
             MessageBoxResult win = MessageBox.Show($"Plugin { plugin.Plugin.PluginInfo.Name}could not be removed completly clean. Uninstall it anyway?", "Client Retry", MessageBoxButton.YesNo, MessageBoxImage.Question);
             if (win.ToString() == "Yes")
             {
                 UninstallPlugin(pluginentry);
             }
             else
             {
                 return;
             }
         }
     }
     Properties.Settings.Default.Save();
 }
Esempio n. 5
0
        private void btnDele_Click(object sender, RoutedEventArgs e)
        {
            if (objDb.IssueFix(Convert.ToInt16(txtMovID.Text)) == false)
            {
                MessageBox.Show("Movie is rented out, cannot delete the Movie.");
                return;
            }

            if (dgMovies.SelectedIndex > -1)
            {
                MessageBoxResult dialogResult = MessageBox.Show("Are you sure you want to delete the Movie ?", " Omega", MessageBoxButton.YesNo);

                if (dialogResult.ToString() == "Yes")
                {
                    DataRowView row     = (DataRowView)dgMovies.SelectedItems[0];
                    Int32       MovieID = Convert.ToInt32(row["MovieID"]);

                    objDb.DeleteMovies(MovieID);
                    MessageBox.Show("Movie Deleted");
                    txtMovie.Clear();
                    txtCost.Clear();
                    txtGenre.Clear();
                    txtRating.Clear();
                    txtYear.Clear();
                    txtStock.Clear();
                    txtMovID.Clear();
                    txtDesc.Clear();

                    dgMovies.ItemsSource = objDb.ListMovies().DefaultView;
                }
            }
            else
            {
                MessageBox.Show("Select Movie to delete");
            }
        }
Esempio n. 6
0
        private void btnDeleteCust_Click(object sender, RoutedEventArgs e)
        {
            if (dgCustomers.SelectedIndex > -1)
            {
                MessageBoxResult dialogResult = MessageBox.Show("Are You Sure You Want To Delete The Customer?  ", "Customer ", MessageBoxButton.YesNoCancel);
                if (dialogResult.ToString() == "Yes")
                {
                    DataRowView row    = (DataRowView)dgCustomers.SelectedItems[0];
                    Int32       CustID = Convert.ToInt32(row["CustID"]);

                    objDB.DeleteCustomer(CustID);
                    MessageBox.Show("Customer Deleted");
                    txtCustFirst.Clear();
                    txtCustLast.Clear();
                    txtAddress.Clear();
                    txtPhone.Clear();
                    dgCustomers.ItemsSource = objDB.ListCustomer("%").DefaultView;
                }
            }
            else
            {
                MessageBox.Show("Select Customer to delete");
            }
        }
Esempio n. 7
0
        static public void ReadCrashLogs(string path = null)
        {
            Crashlogs.Clear();
            if (path == null)
            {
                path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Guild Wars 2\\Arenanet.log";
            }

            try
            {
                long crashlogs_size = new FileInfo(path).Length / 1000000;

                if (crashlogs_size > 10)
                {
                    //Average crashlog size = 12.288 kb
                    MessageBoxResult win = MessageBox.Show("Your crashlog file has an overall size of " + crashlogs_size + " Mb! (est. " + Math.Round((crashlogs_size * 1000 / 12.288), 0) + " Crashlogs!)\nUsing crashlogs this big could decrease performance drastically!\n Should launchbuddy reduce its size?", "Crashlog File too big", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (win.ToString() == "Yes")
                    {
                        string[] lines = File.ReadLines(path).Take(50000).ToArray();
                        File.Delete(path);
                        File.WriteAllLines(path, lines);
                    }
                }

                string[] data = Regex.Split(File.ReadAllText(path), @"\*--> Crash <--\*");
                for (int i = 1; i < data.Length; i++)
                {
                    Crashlogs.Add(new Crashlog(data[i]));
                }

                Crashlogs = new ObservableCollection <Crashlog>(from i in Crashlogs orderby i.CrashTime select i);
                Crashlogs = new ObservableCollection <Crashlog>(Crashlogs.Reverse());

                //Clean up Crashlog

                /*
                 * if (Crashlogs.Count >= 25)
                 * {
                 *  try
                 *  {
                 *      string logs = "";
                 *
                 *      for (int i=2;i<data.Length;i++)
                 *      {
                 *          logs += @"*--> Crash <--*" + data[i];
                 *      }
                 *
                 *      File.Delete(path);
                 *      File.WriteAllText(path,logs);
                 *  }catch (Exception e)
                 *  {
                 *      System.Windows.Forms.MessageBox.Show(e.Message);
                 *  }
                 *
                 * }
                 */
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Could not open Crashlog!\n" + e.Message);
            }
        }
Esempio n. 8
0
        private void dishDel()
        {
            DishItem dishItem = (DishItem)lstDishes.SelectedItem;

            if (dishItem == null)
            {
                return;
            }
            OrderItem order = AppLib.GetCurrentOrder();

            AppLib.WriteAppAction($"CartWin|Удаление блюда '{dishItem.langNames["ru"]}'...");

            string           title  = AppLib.GetLangTextFromAppProp("cartDelDishTitle");
            string           msg    = string.Format("{0} \"{1}\" ?", AppLib.GetLangTextFromAppProp("cartDelDishQuestion"), AppLib.GetLangText(dishItem.langNames));
            MessageBoxResult result = AppLib.ShowChoiceBox(title, msg);

            AppLib.WriteAppAction($"CartWin|Удаление блюда '{dishItem.langNames["ru"]}': {result.ToString()}");

            if (result == MessageBoxResult.Yes)
            {
                order.Dishes.Remove(dishItem);
                lstDishes.Items.Refresh();
                scrollDishes.ScrollToTop();

                updatePriceOrder();
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Gives a result to the message box, allowing its underlying execution tree to continue.
        /// </summary>
        /// <param name="result"></param>
        public void GiveResult(MessageBoxResult result)
        {
            // Message boxes with no callbacks don't give result and silenty return.
            if (_callback == null)
            {
                return;
            }

            switch (result)
            {
            case MessageBoxResult.FirstButton:
                if (FirstButtonLabel == null)
                {
                    throw new InvalidOperationException("There is no first button on this message box.");
                }

                _callback("Button1");

                break;

            case MessageBoxResult.SecondButton:

                if (SecondButtonLabel == null)
                {
                    throw new InvalidOperationException("There is no second button on this message box.");
                }

                _callback("Button2");

                break;

            case MessageBoxResult.Cancel:

                // Cancelled message boxes call the callback with a nil parameter.
                _callback(null);

                break;

            default:
                throw new NotImplementedException("This result type is not implemented: " + result.ToString());
            }
        }
Esempio n. 10
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("メッセージ", "キャプション", MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.Cancel);

            textBox.Text = result.ToString();
        }
Esempio n. 11
0
        public static MessageBoxResult ToUser(eUserMsgKeys messageKey, params object[] messageArgs)
        {
            UserMessage     messageToShow = null;
            string          messageText   = string.Empty;
            MessageBoxImage messageImage  = MessageBoxImage.None;

            try
            {
                //get the message from pool

                // FIXME improve if as already found !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                if ((UserMessagesPool != null) && UserMessagesPool.Keys.Contains(messageKey))
                {
                    messageToShow = UserMessagesPool[messageKey];
                }
                if (messageToShow == null) // Message not found in message pool
                {
                    // We do want to pop the error message so below is just in case...
                    string mess = "";
                    foreach (object o in messageArgs)
                    {
                        mess += o.ToString() + " ";
                    }

                    string txt = messageKey.ToString() + " - " + mess + "{Error message key not found!}";
                    WorkSpaceReporter.MessageBoxShow(txt, "Ginger", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);

                    ToLog(eLogLevel.WARN, "The user message with key: '" + messageKey + "' was not found! and won't show to the user!");
                    return(MessageBoxResult.None);
                }

                //set the message type
                switch (messageToShow.MessageType)
                {
                case eMessageType.ERROR:
                    messageImage = MessageBoxImage.Error;
                    break;

                case eMessageType.INFO:
                    messageImage = MessageBoxImage.Information;
                    break;

                case eMessageType.QUESTION:
                    messageImage = MessageBoxImage.Question;
                    break;

                case eMessageType.WARN:
                    messageImage = MessageBoxImage.Warning;
                    break;

                default:
                    messageImage = MessageBoxImage.Information;
                    break;
                }

                //enter message args if exist
                if (messageArgs.Length > 0)
                {
                    messageText = string.Format(messageToShow.Message, messageArgs);
                }
                else
                {
                    messageText = messageToShow.Message;
                }

                if (CurrentAppLogLevel == eAppReporterLoggingLevel.Debug)
                {
                    ToLog(eLogLevel.INFO, "Showing User Message (Pop-Up): '" + messageText + "'");
                }
                else if (AddAllReportingToConsole)
                {
                    ToConsole(eLogLevel.DEBUG, "Showing User Message (Pop-Up): '" + messageText + "'");
                }

                //show the messege and return user selection
                MessageBoxResult userSelection = WorkSpaceReporter.MessageBoxShow(messageText, messageToShow.Caption, messageToShow.ButtonsType, messageImage, messageToShow.DefualtResualt);


                if (CurrentAppLogLevel == eAppReporterLoggingLevel.Debug)
                {
                    ToLog(eLogLevel.INFO, "User Selection for Pop-Up Message: '" + userSelection.ToString() + "'");
                }
                else if (AddAllReportingToConsole)
                {
                    ToConsole(eLogLevel.DEBUG, "User Selection for Pop-Up Message: '" + userSelection.ToString() + "'");
                }

                return(userSelection);
            }
            catch (Exception ex)
            {
                ToLog(eLogLevel.ERROR, "Failed to show the user message with the key: " + messageKey, ex);

                string txt = "Failed to show the user message with the key: " + messageKey;
                WorkSpaceReporter.MessageBoxShow(txt, "Ginger", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);

                return(MessageBoxResult.None);
            }
        }
Esempio n. 12
0
        public static MessageBoxResult ToUser(eUserMsgKeys messageKey, params object[] messageArgs)
        {
            UserMessage     messageToShow = null;
            string          messageText   = string.Empty;
            MessageBoxImage messageImage  = MessageBoxImage.None;

            try
            {
                //get the message from pool
                if ((UserMessagesPool != null) && UserMessagesPool.Keys.Contains(messageKey))
                {
                    messageToShow = UserMessagesPool[messageKey];
                }
                if (messageToShow == null)
                {
                    // We do want to pop the error message so below is just in case...
                    string mess = "";
                    foreach (object o in messageArgs)
                    {
                        mess += o.ToString() + " ";
                    }
                    MessageBox.Show(messageKey.ToString() + " - " + mess);

                    ToLog(eLogLevel.WARN, "The user message with key: '" + messageKey + "' was not found! and won't show to the user!");
                    return(MessageBoxResult.None);
                }

                //set the message type
                switch (messageToShow.MessageType)
                {
                case eMessageType.ERROR:
                    messageImage = MessageBoxImage.Error;
                    break;

                case eMessageType.INFO:
                    messageImage = MessageBoxImage.Information;
                    break;

                case eMessageType.QUESTION:
                    messageImage = MessageBoxImage.Question;
                    break;

                case eMessageType.WARN:
                    messageImage = MessageBoxImage.Warning;
                    break;

                default:
                    messageImage = MessageBoxImage.Information;
                    break;
                }

                //enter message args if exist
                if (messageArgs.Length > 0)
                {
                    messageText = string.Format(messageToShow.Message, messageArgs);
                }
                else
                {
                    messageText = messageToShow.Message;
                }

                //show the messege and return user selection
                //adding owner window to the message so it will appear on top of any other window including splash screen
                //return MessageBox.Show(messageText, messageToShow.Caption, messageToShow.ButtonsType, messageImage, messageToShow.DefualtResualt);

                if (CurrentAppLogLevel == eAppLogLevel.Debug)
                {
                    ToLog(eLogLevel.INFO, "Showing User Message (Pop-Up): '" + messageText + "'");
                }
                else if (AddAllReportingToConsole)
                {
                    ToConsole("Showing User Message (Pop-Up): '" + messageText + "'");
                }

                MessageBoxResult userSelection = MessageBoxResult.None; //????

                //Show msgbox from Main Window STA
                MainWindowDispatcher.Invoke(() => {
                    Window msgOwnerWin = new Window
                    {
                        Width                 = 0.001,
                        Height                = 0.001,
                        Topmost               = true,
                        ShowInTaskbar         = false,
                        ShowActivated         = true,
                        WindowStyle           = WindowStyle.None,
                        WindowStartupLocation = WindowStartupLocation.CenterScreen
                    };
                    msgOwnerWin.Show();
                    msgOwnerWin.Hide();
                    userSelection = MessageBox.Show(msgOwnerWin, messageText, messageToShow.Caption, messageToShow.ButtonsType,
                                                    messageImage, messageToShow.DefualtResualt);
                    msgOwnerWin.Close();

                    return(userSelection);
                });


                if (CurrentAppLogLevel == eAppLogLevel.Debug)
                {
                    ToLog(eLogLevel.INFO, "User Selection for Pop-Up Message: '" + userSelection.ToString() + "'");
                }
                else if (AddAllReportingToConsole)
                {
                    ToConsole("User Selection for Pop-Up Message: '" + userSelection.ToString() + "'");
                }

                return(userSelection);
            }
            catch (Exception ex)
            {
                ToLog(eLogLevel.ERROR, "Failed to show the user message with the key: " + messageKey, ex);
                MessageBox.Show("Failed to show the user message with the key: " + messageKey);
                return(MessageBoxResult.None);
            }
        }
Esempio n. 13
0
        private void WebClient_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            try
            {
                if (e.Error != null)
                {
                    if (e.Error.Message.Contains("404"))
                    {
                        isUpdateSucOFail = false;
                        MessageBox.Show("远程服务器返回错误");
                        Environment.Exit(0);
                        return;
                    }
                    else
                    {
                        isUpdateSucOFail = false;
                        MessageBox.Show("连接超时");
                        Environment.Exit(0);
                        return;
                    }
                }
                string filePath = AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile//AntennaChat.zip";
                //md5 校验
                //string md5Value=publicAutoUpdate.getFileMd5Value(filePath);
                //string serverMd5Value = publicAutoUpdate.xmlFind("fileMd5Value", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile//update.xml");
                //if ((md5Value + "").Trim() != (serverMd5Value + "").Trim())
                //{
                //    isUpdateSucOFail = false;
                //    MessageBox.Show("文件校验失败,请联系供应商!");
                //    Environment.Exit(0);
                //    return;
                //}
                if (e.Cancelled)
                {
                    isUpdateSucOFail = false;
                    MessageBox.Show("下载被取消!");
                    webClient.Dispose();
                }
                else
                {
                    //下载完成
                    publicAutoUpdate.xmlModify("isDownFileSucess", "1", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                    string path = AppDomain.CurrentDomain.BaseDirectory;
                    webClient.Dispose();
                    bool IsHave = publicAutoUpdate.IsHaveProcess();
                    if (IsHave == true)
                    {
                        MessageBox.Show("检测到七讯正在运行,请关闭该程序以便完成更新操作!");
                        timerUpdata.Interval = TimeSpan.FromMilliseconds(1000);
                        timerUpdata.Tick    += TimerUpdata_Tick;
                        timerUpdata.Start();
                    }
                    else
                    {
                        if (url.Substring(url.Length - 3, 3).ToLower().Contains("exe"))
                        {
                            bool b = publicAutoUpdate.startApplicationExe();
                            if (b == true)
                            {
                                Environment.Exit(0);
                            }
                        }
                        else
                        {
                            //Task<bool> bTask =Task.Factory.StartNew(() => publicAutoUpdate.UnZip(path + "downUpdateFile\\AntennaChat.zip", path, true));
                            //isUnzip = bTask.Result;
                            IsUnizping = true;
                            isUnzip    = publicAutoUpdate.UnZip(path + "downUpdateFile\\AntennaChat.zip", path, true);
                            if (isUnzip == true)
                            {
                                string version = publicAutoUpdate.xmlFind("version", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                bool   modify  = publicAutoUpdate.xmlModify("version", version, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                string title = publicAutoUpdate.xmlFind("title", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                publicAutoUpdate.xmlModify("title", title, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                string describe = publicAutoUpdate.xmlFind("describe", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                publicAutoUpdate.xmlModify("describe", describe, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                string url = publicAutoUpdate.xmlFind("url", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                publicAutoUpdate.xmlModify("url", url, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                string isDownFileSucess = publicAutoUpdate.xmlFind("isDownFileSucess", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                publicAutoUpdate.xmlModify("isDownFileSucess", isDownFileSucess, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                string fileMd5 = publicAutoUpdate.xmlFind("fileMd5Value", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                publicAutoUpdate.xmlModify("fileMd5Value", fileMd5, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                string updateType       = publicAutoUpdate.xmlFind("updateType", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                                bool   modifyUpdateType = publicAutoUpdate.xmlModify("updateType", updateType, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                                if (modifyUpdateType == true)
                                {
                                    DirectoryInfo dir   = new DirectoryInfo(path + "downUpdateFile");
                                    FileInfo[]    files = dir.GetFiles();
                                    foreach (var file in files)
                                    {
                                        File.Delete(file.FullName);
                                    }
                                }
                                this.Hide();
                                //更新名字
                                publicAutoUpdate.AppReName();
                                //更新卸载列表相关数据
                                publicAutoUpdate.SetAppInfo();
                                MessageBoxResult dr = MessageBox.Show("更新成功,是否打开七讯程序?", "温馨提示", MessageBoxButton.YesNo);
                                if (dr.ToString() == "Yes")
                                {
                                    bool isStart = publicAutoUpdate.startApplication();
                                    //if (isStart == true)
                                    //{
                                    //Application.Current.Shutdown();
                                    Environment.Exit(0);
                                    //}
                                }
                                else
                                {
                                    //Application.Current.Shutdown();
                                    Environment.Exit(0);
                                }
                            }

                            else
                            {
                                IsUnizping       = false;
                                isUpdateSucOFail = false;
                                MessageBox.Show("解压覆盖失败!");
                                //Application.Current.Shutdown();
                                Environment.Exit(0);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                IsUnizping = false;
                //MessageBox.Show(ex.ToString() + ex.StackTrace);
                publicAutoUpdate.xmlModify("isDownFileSucess", "0", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                Application.Current.Shutdown();
            }
        }
Esempio n. 14
0
        private void btninstal_Click(object sender, RoutedEventArgs e)
        {
            string[] marki             = { "ExpressFit", "Genie", "Oasis" };
            string[] marki_dun         = { "EXPRESSFit", "Genie", "Oasis" };
            bool     installation_done = false;

            if (cmbBrandstoinstall.SelectedIndex > -1 && cmbBuild.SelectedIndex > -1)
            {
                if (!verifyInstanceOfExec(cmbBrandstoinstall.SelectedValue.ToString()))
                {
                    try
                    {
                        //sciezka szczecin full
                        //string  tmp = @"\\10.128.3.1\DFS_Data_SSC_FS_GenieBuilds\Phoenix\{marki[cmbbrandstoinstall.SelectedIndex]}\{cmbbuild.SelectedValue.ToString()}\Full\{cmbbrandstoinstall.SelectedValue.ToString()}\";
                        string tmp2 = @"\\10.128.3.1\DFS_Data_SSC_FS_GenieBuilds\Phoenix\" + marki[cmbBrandstoinstall.SelectedIndex] + @"\" + cmbBuild.SelectedValue.ToString() + @"\" + "Full" + @"\" + cmbBrandstoinstall.SelectedValue.ToString() + @"\";
                        // naprawić sql BD żeby równe numery obsługiwał
                        if (Directory.Exists(tmp2))
                        {
                            installation_done = true;
                            Process.Start(tmp2 + "Setup.exe");
                        }
                    }
                    catch (Exception)
                    {
                        // sciezka szczecin mini


                        string tmp2 = @"\\10.128.3.1\DFS_Data_SSC_FS_GenieBuilds\Phoenix\" + marki[cmbBrandstoinstall.SelectedIndex] + @"\" + cmbBuild.SelectedValue.ToString() + @"\" + "Mini" + @"\";


                        try
                        {
                            string           message = "Are you sure to install Mini version ?";
                            string           caption = "Build Version Choice";
                            MessageBoxButton buttons = MessageBoxButton.YesNo;

                            if (Directory.Exists(tmp2))
                            {
                                MessageBoxResult result_choice = MessageBox.Show(this, message, caption, buttons);

                                if (result_choice.ToString() == "Yes")
                                {
                                    installation_done = true;
                                    Process.Start(tmp2 + "Media.exe");
                                }
                                else
                                {
                                    return; // wyjscie z metody ??
                                }
                            }
                        }
                        catch {
                            //sciezka do dunskiego // sprawdzic czy cala ok.

                            try
                            {
                                tmp2 = @"\\demant.com\data\KBN\RnD\SWS\Build\Projects\" + marki_dun[cmbBrandstoinstall.SelectedIndex] + @"\" + cmbBuild.SelectedValue.ToString() + @"\" + "Full" + @"\" + cmbBrandstoinstall.SelectedValue.ToString() + @"\" + "Setup.exe";

                                if (Directory.Exists(tmp2))
                                {
                                    installation_done = true;
                                    Process.Start(tmp2 + "Setup.exe");
                                }
                            }
                            catch (Exception)
                            {
                                tmp2 = @"\\demant.com\data\KBN\RnD\SWS\Build\Projects\" + marki_dun[cmbBrandstoinstall.SelectedIndex] + @"\" + cmbBuild.SelectedValue.ToString() + @"\" + "Mini" + @"\" + "Media.exe";
                                try
                                {
                                    string           message = "Are you sure to install Mini version ?";
                                    string           caption = "Build Version Choice";
                                    MessageBoxButton buttons = MessageBoxButton.YesNo;
                                    if (Directory.Exists(tmp2))
                                    {
                                        MessageBoxResult result_choice = MessageBox.Show(this, message, caption, buttons);
                                        if (result_choice.ToString() == "Yes")
                                        {
                                            installation_done = true;
                                            Process.Start(tmp2 + "Media.exe");
                                        }
                                        else
                                        {
                                            return;
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    if (!installation_done)
                    {
                        MessageBox.Show("No Access to File Or Doesnt Exist ");
                    }
                }
                else
                {
                    MessageBox.Show("Brand already installed");
                }
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Converts the <see cref="MessageBoxResult"/> enum to its equivalent <see cref="MessageboxResponce"/> value.
        /// </summary>
        /// <param name="messageboxResult">
        /// The native message box result
        /// </param>
        /// <returns>
        /// The message box response
        /// </returns>
        private static MessageboxResponce GetMessageboxResponceFromResult(MessageBoxResult messageboxResult)
        {
            switch (messageboxResult)
            {
            case MessageBoxResult.Cancel:
                return(MessageboxResponce.Cancel);

            case MessageBoxResult.No:
                return(MessageboxResponce.No);

            case MessageBoxResult.None:
                return(MessageboxResponce.None);

            case MessageBoxResult.OK:
                return(MessageboxResponce.Ok);

            case MessageBoxResult.Yes:
                return(MessageboxResponce.Yes);

            default:
                throw new ArgumentException(string.Format("Unsupported message box result '{0}'"), messageboxResult.ToString());
            }
        }
Esempio n. 16
0
        partial void PublishUIMessageInternal(XElement uiMsgElement)
        {
            // NOTE: This implementation isn't ideal, as a custom form should be shown
            // (see Silverlight SDK). There's only support for a limited number of actions,
            // and no support for options. However, for V1.0, this should do.
            string           messageText      = uiMsgElement.GetAttributeValue(Common.UIMessage.text);
            string           messageTitle     = uiMsgElement.GetAttributeValue(Common.UIMessage.Title);
            MessageBoxButton messageBoxButton = GetMessageBoxButtonsForUIMessage(uiMsgElement);

            MessageBoxResult result = MessageBox.Show(messageText, messageTitle, messageBoxButton);

            // Because WP7 only has support for OK/Cancel buttons, we have to coerce OK/Cancel to possible Yes/No.
            // TODO: Use the notification box from http://wpassets.codeplex.com/ instead, to get additional
            // customisable buttons
            string resultStringAlt = (result == MessageBoxResult.OK ? "Yes" : "No");

            try
            {
                XElement action = uiMsgElement.Descendants("Action").Where(x => x.GetAttributeValue("label") == result.ToString() || x.GetAttributeValue("label") == resultStringAlt).FirstOrDefault();

                if (action != null)
                {
                    XElement[] sendElt = null;
                    XElement   child   = (XElement)action.FirstNode;

                    if (child != null)
                    {
                        if (child.Name == "Request" || child.Name == "Response")
                        {
                            int count = child.Nodes().Count();
                            sendElt = new XElement[count];
                            child   = (XElement)child.FirstNode;
                        }
                        else
                        {
                            sendElt = new XElement[action.Nodes().Count()];
                        }

                        int i = 0;

                        while (child != null)
                        {
                            sendElt[i] = child;
                            child      = (XElement)child.NextNode;
                            i++;
                        }

                        this.CurrentActivity.Exec(sendElt);
                    }
                }
                else
                {
                    // Should do something here, but hopefully it should never get here anyway.
                }
            }
            catch { }
        }
Esempio n. 17
0
        public void Launch()
        {
            try
            {
                while (Status < ClientStatus.Running)
                {
                    //Check if it crashed/closed in between a step
                    if (Status > ClientStatus.Created)
                    {
                        if (!ProcessExists())
                        {
                            MessageBoxResult win = MessageBox.Show("Client " + account.Nickname + " got closed or crashed before a clean Start. Do you want to retry to start this Client?", "Client Retry", MessageBoxButton.YesNo, MessageBoxImage.Question);
                            if (win.ToString() == "Yes")
                            {
                                Status = ClientStatus.None;
                            }
                            else
                            {
                                Account.Settings.RelaunchesLeft = 0;
                                Status = ClientStatus.Crash;
                            }
                        }
                    }

                    switch (Status)
                    {
                    case var expression when(Status < ClientStatus.Configured):
                        ConfigureProcess();

                        SwapGFX();
                        SwapLocalDat();
                        Status = ClientStatus.Configured;
                        break;

                    case var expression when(Status < ClientStatus.Created):
                        Process.Start();

                        Suspend();
                        Status = ClientStatus.Created;
                        break;

                    case var expression when(Status < ClientStatus.Injected):
                        InjectDlls();

                        Resume();
                        Status = ClientStatus.Injected;
                        break;

                    case var expression when(Status < ClientStatus.MutexClosed):
                        CloseMutex();

                        Status = ClientStatus.MutexClosed;
                        break;

                    case var expression when(Status < ClientStatus.Login):
                        if (Account.Settings.Loginfile != null)
                        {
                            PressLoginButton();
                            LocalDatManager.ToDefault();
                        }
                        Status = ClientStatus.Login;
                        break;

                    case var expression when(Status < ClientStatus.Running):
                        RestoreGFX();

                        SetProcessPriority();
                        Status = ClientStatus.Running;
                        try { Focus(); } catch { }
                        try { if (account.Settings.WinConfig != null)
                              {
                                  new Thread(Window_Init).Start();
                              }
                        } catch { }
                        account.Settings.AccountInformation.SetLastLogin();
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Account: " + account.Nickname + "\n\n" + e.Message);
                Status = ClientStatus.None;
                CrashReporter.ReportCrashToAll(e);
            }
            if (Status.HasFlag(ClientStatus.Crash))
            {
                Status = ClientStatus.None;
            }
        }
        private async void CreateUpload_Button(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MapView.Active == null)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("No MapView currently active. Exiting...", "Info");
                    return;
                }
                if (StaticVariables.archesInstanceURL == "" | StaticVariables.archesInstanceURL == null)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Log in to Arches Server...");

                    DockPane pane = FrameworkApplication.DockPaneManager.Find("arches_arcgispro_addin_MainDockpane");
                    if (pane == null)
                    {
                        return;
                    }
                    pane.Activate();
                    return;
                }
                if (StaticVariables.archesNodeid == "" | StaticVariables.archesNodeid == null)
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please, Select a Geometry Node to use...");
                    return;
                }
                if (StaticVariables.archesResourceid != "" && StaticVariables.archesResourceid != null)
                {
                    StaticVariables.archesResourceid = "";
                }

                List <string> archesGeometryCollection = await SaveResourceView.GetGeometryString();

                string archesGeometryString = String.Join(",", archesGeometryCollection);
                Dictionary <string, int> archesGeometryType = SaveResourceView.GetGeometryType(archesGeometryCollection);

                MessageBoxResult messageBoxResult = ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(
                    $"Are you sure you want to submit the selected geometry to create a new resource instance?\n\n" +
                    $"Total {archesGeometryCollection.Count} geometries will be submitted\n" +
                    $"{archesGeometryType["point"]} point(s)\n" +
                    $"{archesGeometryType["line"]} line(s)\n" +
                    $"{archesGeometryType["polygon"]} polygon(s)",
                    "Submit to Arches", MessageBoxButton.OKCancel, MessageBoxImage.Question);

                if (messageBoxResult.ToString() == "OK")
                {
                    string geometryFormat  = "esrijson";
                    string submitOperation = "create";
                    var    result          = await SaveResourceView.SubmitToArches(null, StaticVariables.archesNodeid, archesGeometryString, geometryFormat, submitOperation);

                    StaticVariables.archesResourceid = result["resourceinstance_id"];
                    CreateResourceViewModel.GetResourceIdsCreated();
                    SaveResourceView.RefreshMapView();
                    OpenChromiumButton.IsEnabled = true;
                }
                else
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("The submission is cancelled");
                }
            }
            catch (Exception ex)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Exception: " + ex.Message);
            }
        }
Esempio n. 19
0
		/// <summary>
		/// Gives a result to the message box, allowing its underlying execution tree to continue.
		/// </summary>
		/// <param name="result"></param>
		public void GiveResult(MessageBoxResult result)
		{
			// Message boxes with no callbacks don't give result and silenty return.
			if (_callback == null)
			{
				return;
			}

			switch (result)
			{
				case MessageBoxResult.FirstButton:
					if (FirstButtonLabel == null)
					{
						throw new InvalidOperationException("There is no first button on this message box.");
					}

					_callback("Button1");

					break;

				case MessageBoxResult.SecondButton:

					if (SecondButtonLabel == null)
					{
						throw new InvalidOperationException("There is no second button on this message box.");
					}

					_callback("Button2");

					break;

				case MessageBoxResult.Cancel:

					// Cancelled message boxes call the callback with a nil parameter.
					_callback(null);

					break;

				default:
					throw new NotImplementedException("This result type is not implemented: " + result.ToString());
			}
		} 
 static MessageResult TranslateMessageBoxResult(MessageBoxResult result) {
     var value = result.ToString();
     return (MessageResult)Enum.Parse(typeof(MessageResult), value, true);
 }
Esempio n. 21
0
        private void TimerUpdata_Tick(object sender, EventArgs e)
        {
            if (url.Substring(url.Length - 3, 3).ToLower().Contains("exe"))
            {
                timerUpdata.Stop();
                bool b = publicAutoUpdate.startApplicationExe();
                if (b == true)
                {
                    Environment.Exit(0);
                }
            }
            else
            {
                isHaving = publicAutoUpdate.IsHaveProcess();
                string path = AppDomain.CurrentDomain.BaseDirectory;
                if (isHaving == false)
                {
                    timerUpdata.Stop();
                    isUnzip = publicAutoUpdate.UnZip(path + "downUpdateFile\\AntennaChat.zip", path, true);
                    if (isUnzip == true)
                    {
                        string version = publicAutoUpdate.xmlFind("version", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        bool   modify  = publicAutoUpdate.xmlModify("version", version, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        string title = publicAutoUpdate.xmlFind("title", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        publicAutoUpdate.xmlModify("title", title, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        string describe = publicAutoUpdate.xmlFind("describe", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        publicAutoUpdate.xmlModify("describe", describe, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        string url = publicAutoUpdate.xmlFind("url", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        publicAutoUpdate.xmlModify("url", url, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        string fileMd5 = publicAutoUpdate.xmlFind("fileMd5Value", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        publicAutoUpdate.xmlModify("fileMd5Value", fileMd5, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        string isDownFileSucess = publicAutoUpdate.xmlFind("isDownFileSucess", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        publicAutoUpdate.xmlModify("isDownFileSucess", isDownFileSucess, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        string updateType       = publicAutoUpdate.xmlFind("updateType", AppDomain.CurrentDomain.BaseDirectory + "downUpdateFile\\update.xml");
                        bool   modifyUpdateType = publicAutoUpdate.xmlModify("updateType", updateType, AppDomain.CurrentDomain.BaseDirectory + "version.xml");

                        if (modifyUpdateType == true)
                        {
                            DirectoryInfo dir   = new DirectoryInfo(path + "downUpdateFile");
                            FileInfo[]    files = dir.GetFiles();
                            foreach (var file in files)
                            {
                                File.Delete(file.FullName);
                            }
                        }
                        this.Hide();

                        MessageBoxResult dr = MessageBox.Show("更新成功,是否打开七讯程序!", "温馨提示", MessageBoxButton.YesNo);
                        if (dr.ToString() == "Yes")
                        {
                            bool isStart = publicAutoUpdate.startApplication();
                            if (isStart == true)
                            {
                                Environment.Exit(0);
                            }
                        }
                        else
                        {
                            Environment.Exit(0);
                        }
                    }
                }
                else
                {
                    IsUnizping = false;
                    MessageBox.Show("解压覆盖失败!");
                    Environment.Exit(0);
                }
            }
        }
        static MessageResult TranslateMessageBoxResult(MessageBoxResult result)
        {
            var value = result.ToString();

            return((MessageResult)Enum.Parse(typeof(MessageResult), value, true));
        }
Esempio n. 23
0
        private void Finalizar_Click(object sender, RoutedEventArgs e)
        {
            TarefaModelo item = (TarefaModelo)dgTarefas.SelectedItem;

            item.AtualizaTempoGasto();
            if (item.skus > 0)
            {
                if (MessageBox.Show("Confirma finalização da conferência de " + item.nomesFuncionarios + " após " + item.tempoGasto + "? ", "Produsis", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    if (!abd.FinalizarTarefa(item.idTarefa, 0, 0))
                    {
                        MessageBox.Show("Houve um erro e a conferência não pode ser finalizada.", "Conferência não finalizada - Produsis", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        ListaFunc = abd.GetConferentesLivres("2");
                        CBFuncionario.ItemsSource = ListaFunc;

                        if (ListaFunc.Contains(item.nomesFuncionarios))
                        {
                            CBFuncionario.SelectedValue = item.nomesFuncionarios;

                            MessageBoxResult novaTarefa = MessageBox.Show("Deseja Abrir uma nova tarefa para o funcionário?", "Nova Tarefa", MessageBoxButton.YesNo, MessageBoxImage.Question);
                            if (novaTarefa.ToString().ToUpper() == "YES")
                            {
                                FuncionarioSelecionado = new FuncionariosTag(CBFuncionario.SelectedItem.ToString(), CriaChipTag(CBFuncionario.SelectedItem.ToString()));
                                if (!ListaDeFuncionarios.Items.Contains(FuncionarioSelecionado) && CBFuncionario.SelectedIndex > -1)
                                {
                                    ListaDeFuncionarios.Items.Add(FuncionarioSelecionado);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                item.skus = SKUs.Perguntar(item.volumes);
                if (item.skus > 0)
                {
                    if (!abd.FinalizarTarefa(item.idTarefa, 0, 0))
                    {
                        MessageBox.Show("Houve um erro e a conferência não pode ser finalizada.", "Conferência não finalizada - Produsis", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        ListaFunc = abd.GetConferentesLivres("2");
                        CBFuncionario.ItemsSource = ListaFunc;

                        if (ListaFunc.Contains(item.nomesFuncionarios))
                        {
                            CBFuncionario.SelectedValue = item.nomesFuncionarios;

                            MessageBoxResult novaTarefa = MessageBox.Show("Deseja Abrir uma nova tarefa para o funcionário?", "Nova Tarefa", MessageBoxButton.YesNo, MessageBoxImage.Question);
                            if (novaTarefa.ToString().ToUpper() == "YES")
                            {
                                FuncionarioSelecionado = new FuncionariosTag(CBFuncionario.SelectedItem.ToString(), CriaChipTag(CBFuncionario.SelectedItem.ToString()));
                                if (!ListaDeFuncionarios.Items.Contains(FuncionarioSelecionado) && CBFuncionario.SelectedIndex > -1)
                                {
                                    ListaDeFuncionarios.Items.Add(FuncionarioSelecionado);
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Houve um erro e a conferência não pode ser finalizada.", "Conferência não finalizada - Produsis", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            Documento.Focus();
            RecarregarPendentes();
        }
Esempio n. 24
0
 private void NewMethod(MessageBoxResult result)
 {
     msgboxResult.Text = result.ToString();
 }
Esempio n. 25
0
        partial void PublishUIMessageInternal(XElement uiMsgElement)
        {
            // NOTE: This implementation isn't ideal, as a custom form should be shown
            // (see Silverlight SDK). There's only support for a limited number of actions,
            // and no support for options. However, for V1.0, this should do.
            string           messageText      = uiMsgElement.GetAttributeValue(Common.UIMessage.text);
            string           messageTitle     = uiMsgElement.GetAttributeValue(Common.UIMessage.Title);
            MessageBoxButton messageBoxButton = GetMessageBoxButtonsForUIMessage(uiMsgElement);
            MessageBoxImage  messageBoxImage  = (messageBoxButton == MessageBoxButton.OK ? MessageBoxImage.Information : MessageBoxImage.Question);

            MessageBoxResult result = MessageBox.Show(messageText, messageTitle, messageBoxButton, messageBoxImage);

            try
            {
                XElement action = uiMsgElement.Descendants("Action").Where(x => x.GetAttributeValue("label") == result.ToString()).FirstOrDefault();

                if (action != null)
                {
                    XElement[] sendElt = null;
                    XElement   child   = (XElement)action.FirstNode;

                    if (child != null)
                    {
                        if (child.Name == "Request" || child.Name == "Response")
                        {
                            int count = child.Nodes().Count();
                            sendElt = new XElement[count];
                            child   = (XElement)child.FirstNode;
                        }
                        else
                        {
                            sendElt = new XElement[action.Nodes().Count()];
                        }

                        int i = 0;

                        while (child != null)
                        {
                            sendElt[i] = child;
                            child      = (XElement)child.NextNode;
                            i++;
                        }

                        this.CurrentActivity.Exec(sendElt);
                    }
                }
                else
                {
                    // Should do something here, but hopefully it should never get here anyway.
                }
            }
            catch { }
        }
Esempio n. 26
0
        private void Load_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Get the current ship from the editor
                string        name;     // the editor returns this trimmed
                List <string> layerNames;
                SortedList <int, List <DesignPart> > partsByLayer;
                editor1.GetDesign(out name, out layerNames, out partsByLayer);

                if (partsByLayer.Values.SelectMany(o => o).Count() > 0)
                {
                    #region Prompt for save

                    string prompt = "Save current ship first?";
                    if (name == "")
                    {
                        prompt += "\r\n\r\nYou'll need to give it a name first";
                    }

                    MessageBoxResult result = MessageBox.Show(prompt, this.Title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                    switch (result)
                    {
                    case MessageBoxResult.Yes:
                        if (name == "")
                        {
                            return;             // they need to name it first
                        }
                        else
                        {
                            SaveShip();
                        }
                        break;

                    case MessageBoxResult.No:
                        break;

                    case MessageBoxResult.Cancel:
                        return;

                    default:
                        throw new ApplicationException("Unexpected MessageBoxResult: " + result.ToString());
                    }

                    #endregion
                }

                LoadShip();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        //fin de funciones


        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            /**
             * 1. crear la transferencia en la base, esto sale del encabezado que lleva fecha
             * 2. de la tabla recuperar objetos
             * 3. esos objetos son MP, entonces llenar la lista
             * 4. Insertar cada objeto de la lista a la base
             * **/

            //CREAR OBJETO DE TIPO ENTITIES LLENITO!!
            t_transferencia trans = new t_transferencia();

            trans.t_fecha       = (DateTime)fechadate.SelectedDate;
            trans.t_descripcion = txt_descripcion.Text;
            trans.t_tipo        = (int)cbx_tipo.SelectedIndex + 1;

            //MANDAR EL OBJETO A LA CAPA BLL

            if (!(trans.Equals(null)) && !(trans.t_fecha.Equals(null)))
            {
                MessageBoxResult result = MessageBox.Show("Estas seguro de Guardar la transferencia", "Confirmar", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result.ToString() == "Yes")
                {
                    int id = t_transferencia_BLL.insertar_t_transferencia_BLL(trans);

                    try
                    {
                        if (cbx_tipo.SelectedIndex == 0)
                        {
                            foreach (DataRowView dr in transferencia2.Items)
                            {
                                //agregar detalle de transeferencia
                                //transferencia entrada

                                te_transferenciaEntrada te = new te_transferenciaEntrada();
                                te.te_id_t     = id;
                                te.te_id_mp    = (int)dr[0];
                                te.te_cantidad = (float)dr[1];
                                te_transferencia_BLL.insertar_te_transferencia_BLL(te);
                            }
                        }
                        else
                        {
                            if (cbx_tipo.SelectedIndex == 1)
                            {
                                foreach (DataRowView dr in transferencia2.Items)
                                {
                                    ts_transferenciaSalida ts = new ts_transferenciaSalida();
                                    ts.ts_id_t     = id;
                                    ts.ts_id_mp    = (int)dr[0];
                                    ts.ts_cantidad = (float)dr[1];
                                    ts_transferencia_BLL.insertar_ts_transferencia_BLL(ts);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.Write(ex.Message);
                        MessageBox.Show("Ocurrio un error al recorrer la tabla", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    MessageBox.Show("Registro Guardado");
                    win_t_GestionarTranferencias wg = new win_t_GestionarTranferencias();
                    wg.Show();
                    this.Close();
                }
            }
        }
Esempio n. 28
0
        // удаление ингредиента
        private void ingrDel(object sender, Point point)
        {
            // получить контролы из нажатого элемента
            //    listbox ингредиентов
            ListBoxItem lbiIngr = (ListBoxItem)AppLib.FindVisualParentByType((FrameworkElement)sender, typeof(ListBoxItem));
            ListBox     lbIngr  = (ListBox)AppLib.FindVisualParentByType((FrameworkElement)lbiIngr, typeof(ListBox));
            DishAdding  tmpIngr = (DishAdding)lbIngr.ItemContainerGenerator.ItemFromContainer(lbiIngr);

            int iCnt = lbIngr.ItemContainerGenerator.IndexFromContainer(lbiIngr);

            if (lbIngr.SelectedIndex != iCnt)
            {
                lbIngr.SelectedIndex = iCnt;
            }

            //    listbox блюд
            AppLib.SelectListBoxItemByHisInnerControl((FrameworkElement)lbIngr, lstDishes); // делаем это принудетельно

            DishItem   dishItem = (DishItem)lstDishes.SelectedItem;
            DishAdding ingrItem = (DishAdding)lbIngr.SelectedItem;

            AppLib.WriteAppAction($"CartWin|Нажата кнопка удаления ингредиента '{ingrItem.langNames["ru"]}' для блюда '{dishItem.langNames["ru"]}'");

            string           title  = AppLib.GetLangTextFromAppProp("cartDelIngrTitle");
            string           msg    = string.Format("{0} \"{1}\" ?", AppLib.GetLangTextFromAppProp("cartDelIngrQuestion"), AppLib.GetLangText(ingrItem.langNames));
            MessageBoxResult result = AppLib.ShowChoiceBox(title, msg);

            AppLib.WriteAppAction($"CartWin|Удаление ингредиента {ingrItem.langNames["ru"]}: {result.ToString()}");
            if (result == MessageBoxResult.Yes)
            {
                dishItem.SelectedIngredients.Remove(ingrItem);
                lbIngr.Items.Refresh();

                updatePriceControls();
            }
            this.Activate();
        }
Esempio n. 29
0
        private void btnDeleteMovie_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dgAddMovies.SelectedIndex > -1)
                {
                    MessageBoxResult dialogResult = MessageBox.Show("Are You Sure want to delete the Movie? ", "Easy Hire", MessageBoxButton.YesNo);
                    if (dialogResult.ToString() == "Yes")
                    {
                        DataRowView movierow = (DataRowView)dgAddMovies.SelectedItems[0];

                        String MRating     = Convert.ToString(movierow["Rating"]);
                        string MTitle      = Convert.ToString(movierow["Title"]);
                        string MYear       = Convert.ToString(movierow["Year"]);
                        string MRentalCost = Convert.ToString(movierow["Rental_Cost"]);
                        string MCopies     = Convert.ToString(movierow["Copies"]);
                        string MPlot       = Convert.ToString(movierow["Plot"]);
                        string MGenre      = Convert.ToString(movierow["Genre"]);
                        Int32  MovieID     = Convert.ToInt32(movierow["MovieID"]);
                        Int32  Tot_Copies  = Convert.ToInt32(movierow["Copies"]);

                        Int32 Out_Copies   = objDB.GetCopiesOut(MovieID); //MessageBox.Show(Out_Copies.ToString());
                        Int32 Avail_Copies = Tot_Copies - Out_Copies;

                        if (Out_Copies > 0 && Tot_Copies != 0)
                        {
                            if (Tot_Copies == Avail_Copies) //Delete All the Copies if None of the copies are rented out

                            {
                                objDB.DeleteMovie(MovieID);
                                dgAddMovies.ItemsSource = objDB.ListMovies("%").DefaultView;
                            }


                            if (Avail_Copies > 0)    //Delete Only the availbale Copies ( not the movie) and Update the Table
                            {
                                MessageBoxResult dialogAvailableCopies = MessageBox.Show("Some Copies of the Movie is Rented Out. Do you want to delete the Available Copies? ", "Easy Hire", MessageBoxButton.YesNo);
                                if (dialogAvailableCopies.ToString() == "Yes")
                                {
                                    String Copies      = (Tot_Copies - Avail_Copies).ToString();
                                    bool   MovieEdited = objDB.UpdateMovie(MTitle, MRentalCost, MPlot, MYear, Copies, MGenre, MRating, MovieID);
                                    if (MovieEdited == true)
                                    {
                                        MessageBox.Show(" All Available Copies the Movie is Deleted");
                                        ClearFieldMovie(); //Function call to clear Textboxes
                                        dgAddMovies.ItemsSource = objDB.ListMovies("%").DefaultView;
                                        txtSearchTitle.Clear();
                                    }
                                }
                            }
                            else
                            {
                                MessageBox.Show(Out_Copies.ToString("Can not Delete the Movie  : All Copies Rented Out"));
                            }
                        }
                        else
                        {
                            objDB.DeleteMovie(MovieID);
                            MessageBox.Show("  Movie  Deleted ");
                            dgAddMovies.ItemsSource = objDB.ListMovies("%").DefaultView;
                            ClearFieldMovie();
                        }
                    }
                    else
                    {
                        //MessageBox.Show("Unable To Delete, Movie currently out");
                        ClearFieldMovie();

                        dgAddMovies.ItemsSource = objDB.ListMovies("%").DefaultView;
                    }
                }
                else
                {
                    MessageBox.Show("Select a Movie to Delete");
                }
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.Message);
            }
        }
 public MessageBoxWpfButton(MessageBoxResult value, object content = null, object tooltip = null)
     : this(value.ToString(), content ?? value.ToString(), tooltip)
 {
 }