コード例 #1
0
        public ExpectedDelayViewModel(Area area, TrainInformation train, Schedule schedule)
        {
            m_Area        = area;
            m_Train       = train;
            SaveCommand   = new CommandHandler(__Save, false);
            m_LiveDataBll = new LiveDataBLL();

            if (m_Train == null)
            {
                var createResult = m_LiveDataBll.CreateLiveTrainInformation(schedule.Train.Number, schedule.Station.ESTW);

                if (createResult.Succeeded)
                {
                    m_Train = createResult.Result;
                }
                else
                {
                    MessageBox.Show(createResult.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }

            var candidates = m_Train.Schedules.Where((s1, i1) => !m_Train.Schedules.Skip(i1 + 1).Any(s2 => s2.IsArrived)) // Must be first criterion due to indizes
                             .Where(s => !s.IsDeparted)
                             .Where(s => s.Schedule.Station.ESTW.Stations.Any(s2 => Runtime.VisibleStations.Contains(s2)))
                             .GroupBy(s => new { s.Schedule.Station.ShortSymbol, s.Schedule.Time })
                             .Select(g => g.FirstOrDefault());

            Schedules        = new ObservableCollection <LiveSchedule>(candidates);
            SelectedSchedule = Schedules.FirstOrDefault(s => s.Schedule.Station.ShortSymbol == schedule.Station.ShortSymbol && s.Schedule.Time == schedule.Time);

            m_ArrivalChanged   = false;
            m_DepartureChanged = false;
        }
コード例 #2
0
        private void TextBoxSearchPresetsKeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Escape)
                {
                    _mainWindowLocalization.TreeViewSearchText = string.Empty;
                    TextBoxSearchPresets.UpdateLayout();
                }

                if (_mainWindowLocalization.TreeViewSearchText.Length == 0)
                {
                    _treeViewSearch.Reset();
                    treeViewPresets.SetTreeViewState(_treeViewState);
                }
                else
                {
                    _treeViewSearch.Search(_mainWindowLocalization.TreeViewSearchText);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to execute search successfully.");
                App.WriteToErrorLog("Failed to execute search successfully", ex.Message, ex.StackTrace);
            }
        }
コード例 #3
0
 /// <summary>
 /// Opens the project
 /// </summary>
 private void OpenProject(object parameters)
 {
     try
     {
         string path = ((object[])parameters)[0].ToStr();
         if (File.Exists(path))
         {
             Window  currentWindow = (Window)((object[])parameters)[1];
             Project project       = Project.Load(path);
             currentWindow.Hide();
             new ProjectWindow(new ProjectViewModel(project)).Show();
             currentWindow.Close();
         }
         else
         {
             if (MessageBox.Show(Resources.IntroductionWindow_ProjectDoesNotExistMessage_Text, Resources.IntroductionWindow_ProjectDoesNotExistMessage_Caption, MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
             {
                 RecentProject.Delete(path);
                 Messenger.Instance.Send(MessageType.RecentProjectDeleted);
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Logger.Error(ex, "Unable to open project");
         FormsHelper.ShowUnexpectedError();
     }
 }
コード例 #4
0
 public void ShowError(string Message)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         MessageBox.Show(Message, Resources.ErrorOccured, MessageBoxButton.OK, MessageBoxImage.Error);
     });
 }
コード例 #5
0
        private void OnAutoStartButtonClick(object sender, RoutedEventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.OpenSubKey
                                 ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

            var msgBox = new Xceed.Wpf.Toolkit.MessageBox()
            {
                WindowBackground  = this.BorderBrush,
                Background        = this.Background,
                BorderBrush       = this.BorderBrush,
                BorderThickness   = this.BorderThickness,
                Foreground        = Caption.Foreground,
                CaptionForeground = Caption.Foreground,
                Text    = "Application scheduled for startup",
                Caption = "Startup",
                ButtonRegionBackground = this.Background
            };

            var v = rk.GetValue("CloudSync");

            if (rk.GetValue("CloudSync") == null || rk.GetValue("CloudSync").ToString() != Application.ResourceAssembly.Location)
            {
                rk.SetValue("CloudSync", Application.ResourceAssembly.Location);
                msgBox.ShowDialog();
                StartupButton.BorderBrush = new SolidColorBrush(Colors.LightGreen);
            }
            else
            {
                rk.DeleteValue("CloudSync", false);
                msgBox.Text = "Application start up disabled";
                msgBox.ShowDialog();
                StartupButton.BorderBrush = new SolidColorBrush(Colors.Orange);
            }
        }
コード例 #6
0
        private void BtnSendXml_Click(object sender, RoutedEventArgs e)
        {
            this.StartWait("Aguarde. Comunicando com SAT...");
            var tsat = Task.Run(() =>
            {
                try
                {
                    var cupomXml = LerArqTxt(PegarPathArq());
                    if (!cupomXml.IsNullOrEmpty())
                    {
                        SatModelEnum modeloSat =
                            (SatModelEnum)Enum.Parse(typeof(SatModelEnum), InstanceManager.Parametros.ModeloSat);
                        var sat =
                            new Syslaps.Pdv.Core.Dominio.SAT.Sat(
                                SatBase.Create(InstanceManager.Parametros.CodigoSat, modeloSat), new RepositorioBase(), InstanceManager.Parametros);

                        var retSat = sat.EnviarVenda(cupomXml);
                        MessageBox.Show(retSat.RawResponse);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Concat("Falha ao se comunicar com SAT.\nMensagem: ", ex.Message), InstanceManager.Parametros.TituloDasMensagens, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            });

            tsat.Wait(10000);
            this.StopWait();
        }
コード例 #7
0
 public bool ShowYesNo(string Message, string Title)
 {
     return(Application.Current.Dispatcher.Invoke(() =>
     {
         return MessageBox.Show(Message, Title, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes;
     }));
 }
コード例 #8
0
ファイル: LoginViewModel.cs プロジェクト: Nickname10/Strider
        private void LoginAction(object obj)
        {
            var password = (obj as PasswordBox)?.Password;

            LoginForm.Password = HashCalculator.Calculator.CalculateMd5(password);
            try
            {
                if (LoginForm.Validate())
                {
                    var client       = new LoginSessionService.LoginSessionClient("NetTcpBinding_ILoginSession");
                    var loggedClient = client.Connect(LoginForm.Email, LoginForm.Password);
                    if (loggedClient == null)
                    {
                        throw new Exception("Wrong mail or password");
                    }
                    new GameClientWindow(loggedClient, client).Show();
                    _frame.Window.Close();
                }
                else
                {
                    throw new Exception("Wrong mail or password");
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message,
                                "Authorization error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
コード例 #9
0
        void TestClick(object sender, RoutedEventArgs e)
        {
            if (_connectionTester != null)
            {
                Exception ex;

                try
                {
                    Mouse.OverrideCursor = Cursors.Wait;
                    ex = _connectionTester(DataContext as ConnectionViewModel);
                }
                finally
                {
                    Mouse.OverrideCursor = null;
                }


                if (ex == null)
                {
                    MessageBox.Show(this, "Successful!", "Connection Test", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show(this, ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
コード例 #10
0
        private void __StartEstwOnline()
        {
            var SettingsResult = m_SettingsBll.GetSettings();

            if (SettingsResult.Succeeded && SettingsResult.Result != null)
            {
                if (SettingsResult.Result.EstwOnlinePath.IsNullOrWhiteSpace())
                {
                    MessageBox.Show(StatusBarText = "ESTWonline Pfad nicht gesetzt", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    string EstwOnlinePath = Path.Combine(SettingsResult.Result.EstwOnlinePath, "ESTWonline.exe");

                    if (!File.Exists(EstwOnlinePath))
                    {
                        MessageBox.Show("ESTWonline Pfad ungültig", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        try
                        {
                            Process.Start(EstwOnlinePath);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(String.Format("Konnte ESTWonline nicht starten: {0}", ex.Message), "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                }
            }
        }
コード例 #11
0
        private void __ShowTrainScheduleWindow()
        {
            if (!TrainScheduleNumber.HasValue)
            {
                return;
            }

            if (m_CurrentArea.Trains.ContainsKey(TrainScheduleNumber.Value))
            {
                var Train  = m_CurrentArea.Trains[TrainScheduleNumber.Value];
                var Window = new TrainScheduleView(TrainScheduleNumber.Value);
                var VM     = new TrainScheduleViewModel(Window.Dispatcher, Train, m_CurrentArea);
                __OpenChildWindow(Window, VM);
            }
            else if (m_CurrentArea.LiveTrains.ContainsKey(TrainScheduleNumber.Value))
            {
                var Train  = m_CurrentArea.LiveTrains[TrainScheduleNumber.Value];
                var Window = new TrainScheduleView(TrainScheduleNumber.Value);
                var VM     = new TrainScheduleViewModel(Window.Dispatcher, Train.Train, m_CurrentArea);
                __OpenChildWindow(Window, VM);
            }
            else
            {
                MessageBox.Show(String.Format("Unbekannte Zugnummer: {0}", TrainScheduleNumber), "Zuglauf", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            IsTrainScheduleDropDownOpen = false;
        }
コード例 #12
0
        private void MenuCopyLayoutToClipboardClick(object sender, RoutedEventArgs e)
        {
            try
            {
                using (var ms = new MemoryStream())
                {
                    annoCanvas.Normalize(1);
                    _layoutLoader.SaveLayout(annoCanvas.PlacedObjects, ms);

                    var jsonString = Encoding.UTF8.GetString(ms.ToArray());

                    Clipboard.SetText(jsonString, TextDataFormat.UnicodeText);

                    string language = Localization.Localization.GetLanguageCodeFromName(SelectedLanguage);

                    MessageBox.Show(Localization.Localization.Translations[language]["ClipboardContainsLayoutAsJson"],
                                    Localization.Localization.Translations[language]["Successful"],
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Information,
                                    MessageBoxResult.OK);
                }
            }
            catch (Exception ex)
            {
                App.WriteToErrorLog("Error saving layout to JSON", ex.Message, ex.StackTrace);
                MessageBox.Show(ex.Message, "Something went wrong while saving the layout.");
            }
        }
コード例 #13
0
        /// <summary>
        /// Renders the current layout to file.
        /// </summary>
        /// <param name="exportZoom">indicates whether the current zoom level should be applied, if false the default zoom is used</param>
        /// <param name="exportSelection">indicates whether selection and influence highlights should be rendered</param>
        public void ExportImage(bool exportZoom, bool exportSelection)
        {
            var dialog = new SaveFileDialog
            {
                DefaultExt = Constants.ExportedImageExtension,
                Filter     = Constants.ExportDialogFilter
            };

            if (!string.IsNullOrEmpty(annoCanvas.LoadedFile))
            {
                // default the filename to the same name as the saved layout
                dialog.FileName = Path.GetFileNameWithoutExtension(annoCanvas.LoadedFile);
            }

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    RenderToFile(dialog.FileName, 1, exportZoom, exportSelection, statisticsView.IsVisible);

                    MessageBox.Show(this,
                                    Localization.Localization.Translations[Localization.Localization.GetLanguageCodeFromName(SelectedLanguage)]["ExportImageSuccessful"],
                                    Localization.Localization.Translations[Localization.Localization.GetLanguageCodeFromName(SelectedLanguage)]["Successful"],
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
                catch (Exception e)
                {
                    App.WriteToErrorLog("Error exporting image", e.Message, e.StackTrace);
                    MessageBox.Show(e.Message, "Something went wrong while exporting the image.");
                }
            }
        }
コード例 #14
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Xceed.Wpf.Toolkit.MessageBox mb = new Xceed.Wpf.Toolkit.MessageBox();
     mb.Caption = "Caption";
     mb.Text    = "Text";
     mb.ShowDialog();
 }
コード例 #15
0
 public void CreateSessionAction(object obj)
 {
     try
     {
         if (GameSessionForm.Validate())
         {
             var gameSession = new GameSession(GameSessionForm.Name,
                                               GameSessionForm.MapSize, GameSessionForm.MaxPlayers, GameSessionForm.Description);
             if (_loginSessionNetworkClient.CreateGameSession(gameSession, _loggedClient.SessionToken))
             {
                 _frame.ShowMenuPage();
             }
             else
             {
                 throw new Exception("Creation error");
             }
         }
         else
         {
             throw new Exception("Wrong form");
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
コード例 #16
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (!_isValidData)
     {
         MessageBox.Show("Click Verify Button First",
                         "Verify Slide Contents First",
                         MessageBoxButton.OK, MessageBoxImage.Warning);
         return;
     }
     _slide = new ImpressSlide
     {
         Id          = txtID.Text.Trim(),
         DataX       = Convert.ToInt16(txtDataX.Text.Trim()),
         DataY       = Convert.ToInt16(txtDataY.Text.Trim()),
         DataZ       = Convert.ToInt16(txtDataZ.Text.Trim()),
         DataRotateX = Convert.ToInt16(txtDataRotateX.Text.Trim()),
         DataRotateY = Convert.ToInt16(txtDataRotateY.Text.Trim()),
         DataRotateZ = Convert.ToInt16(txtDataRotateZ.Text.Trim()),
         DataScale   = 1,
         SlideMatter = _rtb.Lines,
         DataRotate  = Convert.ToInt16(DataRotate.Text.Trim()),
         Header      = txtSlideHeader.Text.Trim()
     };
     _slide.Class = (cmbSlideType.Text == "Step Slide") ? "Step Slide" : "Step";
     MessageBox.Show("Successfully created new slide",
                     "Success",
                     MessageBoxButton.OK, MessageBoxImage.Information);
     Close();
 }
コード例 #17
0
 private void btnUpdateSlide_Click(object sender, RoutedEventArgs e)
 {
     if (
         CheckNumeric(txtDataX.Text) &&
         CheckNumeric(txtDataY.Text) &&
         CheckNumeric(txtDataZ.Text) &&
         CheckNumeric(txtDataRotateX.Text) &&
         CheckNumeric(txtDataRotateY.Text) &&
         CheckNumeric(txtDataRotateZ.Text) &&
         CheckNumeric(txtDataRotate.Text) &&
         CheckNumeric(txtDataScale.Text))
     {
         ImpressSlide temp = _slides[lstSlides.SelectedIndex];
         UpdateSlide(ref temp);
         _slides[lstSlides.SelectedIndex] = temp;
         MessageBox.Show("Successfully modified step slide", "Success",
                         MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         MessageBox.Show("There are some invalid fields",
                         "Check Data Again",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #18
0
        public bool?ShowQuestionWithCancel(object owner, string message, string title)
        {
            MessageBoxResult result;

            if (owner is Window ownerWindow)
            {
                result = MessageBox.Show(ownerWindow,
                                         message,
                                         title,
                                         MessageBoxButton.YesNoCancel,
                                         MessageBoxImage.Question);
            }
            else
            {
                result = MessageBox.Show(message,
                                         title,
                                         MessageBoxButton.YesNoCancel,
                                         MessageBoxImage.Question);
            }

            switch (result)
            {
            case MessageBoxResult.Yes:
                return(true);

            case MessageBoxResult.No:
                return(false);

            default:
                return(null);
            }
        }
コード例 #19
0
        /// <summary>
        /// Shows the specified yes/no question.
        /// </summary>
        /// <param name="owner">The window that owns this Message Window.</param>
        /// <param name="message">The question.</param>
        /// <returns><c>true</c> for yes and <c>false</c> for no.</returns>
        public bool ShowYesNoQuestion(string message)
        {
            OnBefore();

            var ownerWindow = GetWindow();
            var result      = MessageBoxResult.None;

            if (ownerWindow != null)
            {
                UIDispatcher.Execute(() =>
                {
                    result = MessageBox.Show(ownerWindow, message, ApplicationInfo.ProductName, MessageBoxButton.YesNo,
                                             MessageBoxImage.Question, MessageBoxResult.No, GetStyle());
                });
            }
            else
            {
                UIDispatcher.Execute(() =>
                {
                    result = MessageBox.Show(message, ApplicationInfo.ProductName, MessageBoxButton.YesNo,
                                             MessageBoxImage.Question, MessageBoxResult.No, GetStyle());
                });
            }

            OnAfter();

            return(result == MessageBoxResult.Yes);
        }
コード例 #20
0
ファイル: SenderBox.xaml.cs プロジェクト: 1szef1/PizzaIsland
        private void Test_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                btnSave.IsEnabled = btnTest.IsEnabled = false;

                var dr = MSB.Show("Zostanie wysłana wiadomość testowa. Kontynuować?", "Wiadomość testowa",
                                  MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                if (dr != MessageBoxResult.Yes)
                {
                    return;
                }

                boxInfo.SetPassword(pwdBox.Password);
                new Resender().SendTestMessage(boxInfo, boxInfo.FromEmail);

                MSB.Show("Wiadomość wysłana.", "Test skrzynki nadawczej", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MSB.Show(ex.Message, "Test skrzynki nadawczej", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                btnSave.IsEnabled = btnTest.IsEnabled = true;
            }
        }
コード例 #21
0
        void ChooseType(object sender, RoutedEventArgs e)
        {
            if (_model != null)
            {
                var oldCursor = Cursor;

                try
                {
                    Mouse.OverrideCursor = Cursors.Wait;

                    _model.CustomAssemblyPath = _model.CustomAssemblyPath.Trim();

                    var assembly    = DataContextDriver.LoadAssemblySafely(_model.CustomAssemblyPath);
                    var customTypes = assembly.GetExportedTypes().Where(IsDataConnection).Select(t => t.FullName).Cast <object>().ToArray();

                    Mouse.OverrideCursor = oldCursor;

                    var result = (string)Dialogs.PickFromList("Choose Custom Type", customTypes);

                    if (result != null)
                    {
                        _model.CustomTypeName = result;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Assembly load error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                finally
                {
                    Mouse.OverrideCursor = oldCursor;
                }
            }
        }
コード例 #22
0
        private void BtnSaveAs_Click(object sender, RoutedEventArgs e)
        {
            if (_bindingLogic.EditableBindingFile == null)
            {
                MessageBox.Show("You haven't opened a binding file yet. Please open a binding file before saving.");
                return;
            }

            var saveFileDialog = new SaveFileDialog()
            {
                InitialDirectory = Properties.Settings.Default.FileDialogPath
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                var fileName = saveFileDialog.FileName;

                Properties.Settings.Default.FileDialogPath = System.IO.Path.GetDirectoryName(fileName);
                Properties.Settings.Default.Save();

                _bindingLogic.SaveBindingFile(saveFileDialog.FileName);

                SetTitle(fileName);
            }
        }
コード例 #23
0
        void OKClick(object sender, RoutedEventArgs e)
        {
            Exception ex;

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                ex = _connectionTester?.Invoke(DataContext as ConnectionViewModel);
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }

            if (ex == null)
            {
                DialogResult = true;
            }
            else
            {
                if (MessageBox.Show(
                        this,
                        $"{ex.Message}\r\n\r\nDo you want to continue?",
                        "Error",
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Stop) == MessageBoxResult.Yes)
                {
                    DialogResult = true;
                }
            }
        }
コード例 #24
0
ファイル: ViewFactory.cs プロジェクト: Jason6583/ClientNimbus
        public void ShowMessage(string message)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(() => ShowMessage(message));
            }
            else
            {
                if (String.IsNullOrWhiteSpace(message))
                {
                    return;
                }

                var window = GetActiveWindow();
                if (window == null)
                {
                    MessageBox.Show(message, "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show(window, message, "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
コード例 #25
0
 public void DestroyCallback()
 {
     _sessionWindow.Close();
     MessageBox.Show("You were destroyed!",
                     "ooops!",
                     MessageBoxButton.OK,
                     MessageBoxImage.Information);
 }
コード例 #26
0
 public void DeleteSelectedSlicerSettingQuestion(SlicerSettingsModel current)
 {
     if (MessageBox.Show(Localization.Instance.CurrentLanguage.RemoveSlicerConfigQuestion, Localization.Instance.CurrentLanguage.DeleteTitle,
                         MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         DeleteSelectedSlicerSetting(current);
     }
 }
コード例 #27
0
        public void ShowDialog(string messageText, string caption, MessageBoxButton messageBoxButton, MessageBoxImage messageBoxImage)
        {
            var style = new Style(typeof(MessageBox));

            style.Setters.Add(new Setter(MessageBox.WindowBackgroundProperty, System.Windows.Media.Brushes.White));
            style.Setters.Add(new Setter(MessageBox.BorderBrushProperty, System.Windows.Media.Brushes.LightGray));

            MessageBox.Show(Application.Current.MainWindow, messageText, caption, messageBoxButton, messageBoxImage, style);
        }
コード例 #28
0
        private async Task CheckForPresetsAsync()
        {
            var foundRelease = await _commons.UpdateHelper.GetAvailableReleasesAsync(ReleaseType.Presets);

            if (foundRelease == null)
            {
                return;
            }

            var isNewReleaseAvailable = foundRelease.Version > new Version(annoCanvas.BuildingPresets.Version);

            if (isNewReleaseAvailable)
            {
                string language = Localization.Localization.GetLanguageCodeFromName(SelectedLanguage);

                if (MessageBox.Show(Localization.Localization.Translations[language]["UpdateAvailablePresetMessage"],
                                    Localization.Localization.Translations[language]["UpdateAvailableHeader"],
                                    MessageBoxButton.YesNo,
                                    MessageBoxImage.Asterisk,
                                    MessageBoxResult.OK) == MessageBoxResult.Yes)
                {
                    busyIndicator.IsBusy = true;

                    if (!Commons.CanWriteInFolder())
                    {
                        //already asked for admin rights?
                        if (Environment.GetCommandLineArgs().Any(x => x.Trim().Equals(Constants.Argument_Ask_For_Admin, StringComparison.OrdinalIgnoreCase)))
                        {
                            MessageBox.Show($"You have no write access to the folder.{Environment.NewLine}The update can not be installed.",
                                            Localization.Localization.Translations[language]["Error"],
                                            MessageBoxButton.OK,
                                            MessageBoxImage.Warning);

                            busyIndicator.IsBusy = false;
                            return;
                        }

                        MessageBox.Show(Localization.Localization.Translations[language]["UpdateRequiresAdminRightsMessage"],
                                        Localization.Localization.Translations[language]["AdminRightsRequired"],
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Information,
                                        MessageBoxResult.OK);

                        Commons.RestartApplication(true, Constants.Argument_Ask_For_Admin, App.ExecutablePath);
                    }

                    //Context is required here, do not use ConfigureAwait(false)
                    var newLocation = await _commons.UpdateHelper.DownloadReleaseAsync(foundRelease);

                    busyIndicator.IsBusy = false;

                    Commons.RestartApplication(false, null, App.ExecutablePath);

                    Environment.Exit(-1);
                }
            }
        }
コード例 #29
0
        void ICommand.Execute(object parameter)
        {
            var toChange = (from schedule in RunTimeContext.Context.DatabaseContext.Schedules
                            where schedule.Id == _viewModel.SelectedSchedule.Id
                            select schedule).SingleOrDefault();

            string         dayString = string.Empty;
            ScheduleWindow sw        = (ScheduleWindow)parameter;

            if ((bool)sw.MoncheckBox.IsChecked)
            {
                dayString += "Mon,";
            }
            if ((bool)sw.TuecheckBox.IsChecked)
            {
                dayString += "Tue,";
            }
            if ((bool)sw.WencheckBox.IsChecked)
            {
                dayString += "Wen,";
            }
            if ((bool)sw.ThucheckBox.IsChecked)
            {
                dayString += "Thu,";
            }
            if ((bool)sw.FricheckBox.IsChecked)
            {
                dayString += "Fri,";
            }
            if ((bool)sw.SatcheckBox.IsChecked)
            {
                dayString += "Sat,";
            }
            if ((bool)sw.SuncheckBox.IsChecked)
            {
                dayString += "Sun,";
            }
            dayString = dayString.TrimEnd(new char[] { ',' });
            if (toChange != null)
            {
                toChange = _viewModel.SelectedSchedule;
            }
            else
            {
                _viewModel.SelectedSchedule.DayOfWeek = dayString;
                RunTimeContext.Context.DatabaseContext.Schedules.Add(_viewModel.SelectedSchedule);
            }
            RunTimeContext.Context.DatabaseContext.SaveChanges();
            MessageBox.Show("New schedule saved.");
            var window = parameter as Window;

            if (window != null)
            {
                window.Close();
            }
        }
コード例 #30
0
        private void ShowRegistrationMessageBox(bool isDeregistration)
        {
            string language = AnnoDesigner.Localization.Localization.GetLanguageCodeFromName(SelectedLanguage);
            var    message  = isDeregistration ? AnnoDesigner.Localization.Localization.Translations[language]["UnregisterFileExtensionSuccessful"] : AnnoDesigner.Localization.Localization.Translations[language]["RegisterFileExtensionSuccessful"];

            MessageBox.Show(message,
                            AnnoDesigner.Localization.Localization.Translations[language]["Successful"],
                            MessageBoxButton.OK,
                            MessageBoxImage.Information);
        }
コード例 #31
0
        void ShowToolkit()
        {
            //var buttonStyle = Application.Current.FindResource("LabelTemplate") as Style;
            //List<KeyValuePair<object, object>> styles = new List<KeyValuePair<object, object>>();

            //foreach (var dictionary in Application.Current.Resources.MergedDictionaries)
            //{
            //    foreach (var key in dictionary.Keys)
            //    {
            //        styles.Add(new KeyValuePair<object, object>(key, dictionary[key]));
            //    }
            //}

            //var keys = styles.Select(a => a.Key);
            //var unique = styles.Count == keys.Distinct().Count();

            var buttonDefaultStyle = (Style)Application.Current.FindResource(typeof(Button));

            //var buttonStyles = styles.Where(a => a.Value is Style && ((Style)a.Value)
            //    .TargetType == typeof(Button)).ToArray();
            System.Windows.Style style = new System.Windows.Style();
            style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.YesButtonContentProperty, "Yes, FTW!"));
            style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonContentProperty, "Omg, no"));
            style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonStyleProperty, buttonDefaultStyle));

            var b = new Xceed.Wpf.Toolkit.MessageBox();
            b.OkButtonStyle = buttonDefaultStyle;
            var x = b.ShowDialog();

            Xceed.Wpf.Toolkit.MessageBox.Show(
                InnerText,
                InnerCaption,
                MessageBoxButton.YesNo,
                MessageBoxImage.Information,
                MessageBoxResult.No,
                style);
        }
コード例 #32
0
ファイル: MainWindow.xaml.cs プロジェクト: xcasadio/FlowGraph
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuItem_HelpClick(object sender, RoutedEventArgs e)
        {
            Xceed.Wpf.Toolkit.MessageBox msgBox = new Xceed.Wpf.Toolkit.MessageBox();
            windowContainer.Children.Add(msgBox);

            var img = new Image { Source = new BitmapImage( new Uri(
                        "pack://application:,,,/FlowSimulator;component/Resources/Mattahan-Ultrabuuf-Comics-War-Machine.ico"))
            };
            msgBox.ImageSource = img.Source;

            msgBox.ShowMessageBox(
                "Flow Simulator version " + Assembly.GetExecutingAssembly().GetName().Version + Environment.NewLine +
                "Developed by Xavier Casadio",
                "Information",
                MessageBoxButton.OK);
        }