Exemplo n.º 1
0
 private void ResetButton_Click(object sender, RoutedEventArgs e)
 {
     var description = Attributes.GetDescription(_MappedTo);
     var text = string.Format("Do you really want to reset all {0} settings?", description);
     var form = new MessageBoxWindow();
     var result = form.ShowDialog(text, "Reset Controller Settings", MessageBoxButton.YesNo, MessageBoxImage.Question);
     if (result == MessageBoxResult.Yes)
     {
         //MainForm.Current.ReloadXinputSettings();
     }
 }
Exemplo n.º 2
0
        private void SynchronizeToHidGuardianMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var canModify = AppHelper.SynchronizeToHidGuardian();

            if (!canModify)
            {
                var form = new MessageBoxWindow();
                form.ShowDialog("Can't modify HID Guardian registry.\r\nPlease run this application as Administrator once in order to fix permissions.", "Permission Denied",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Shows the message.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="parentWindow">The parent window.</param>
        /// <returns>MessageBoxResult.</returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public MessageBoxResult ShowMessage(MessageBoxInfo options, Window parentWindow)
        {
            return(parentWindow.Dispatcher.Invoke(() =>
            {
                var win = new MessageBoxWindow(options);

                win.ShowModal(parentWindow);

                return win.MessageBoxResult;
            }));
        }
Exemplo n.º 4
0
        private void ShowEnumeratedDevicesMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var devices = ViGEm.HidGuardianHelper.GetEnumeratedDevices();
            var form    = new MessageBoxWindow();
            var text    = devices.Length == 0
                                ? "None"
                          // Join and make && visible.
                                : string.Join("\r\n", devices).Replace("&", "&&");

            form.ShowDialog(text, "Enumerated Devices", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Exemplo n.º 5
0
        public static MessageBoxResult Show(Window owner, string messageBoxText, string caption)
        {
            MessageBoxWindow msg = new MessageBoxWindow(messageBoxText, caption)
            {
                Owner = owner
            };

            msg.ShowDialog();

            return(msg.Result);
        }
Exemplo n.º 6
0
 private void button4_Click(object sender, RoutedEventArgs e)
 {
     IsSuccess = ViewModelCampusWindow.ButtomSubmit();
     if (IsSuccess)
     {
         MessageBoxWindow mbw = new MessageBoxWindow();
         mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Success, "操作成功!");
         mbw.ShowDialog();
         this.Close();
     }
 }
Exemplo n.º 7
0
    public AutoEditorTipButton(string tip, bool end = true)
    {
        this.tip = tip;
        this.end = end;
        GUILayout.BeginHorizontal();
#if UNITY_EDITOR
        if (!end && GUILayout.Button("", EditorUtil.TipButton))
        {
            MessageBoxWindow.ShowWindow(true, tip);
        }
#endif
    }
Exemplo n.º 8
0
        public static bool?ShowQuestionYesNo(string message, string detail)
        {
            MessageBoxWindow window = new MessageBoxWindow();

            window.Title       = LanguageString.Find("Presentation_Windows_MessageBoxWindow_Question");
            window.Message     = message;
            window.Detail      = detail;
            window.WindowType  = MessageBoxWindowType.Information;
            window.ButtonsType = MessageBoxWindowButtonsType.YesNo;

            return(window.ShowDialog());
        }
Exemplo n.º 9
0
 public Tableau(String WilayaName)
 {
     try
     {
         config = App.Config;
         config.import("config.json");
         inputSynthese = new InputSynthese(DateTime.Today, DateTime.Today, config.getWilaya(WilayaName).path);
         InitializeComponent();
         date1.SelectedDate = date2.SelectedDate = DateTime.Today;
         this.WilayaName    = WilayaName;
         done = true;
     }
     catch (FileNotFoundException error)
     {
         MessageBoxWindow mb = new MessageBoxWindow("Le chemmin de la wilaya " + WilayaName + "\n n'existe pas ", false);
         mb.messageErreur.Visibility = Visibility.Hidden;
         mb.casSpecial.Content       = "Ajouter Dataset";
         mb.casSpecial.Visibility    = Visibility.Visible;
         mb.casSpecial.Click        += (object Sender, RoutedEventArgs a) =>
         {
             MainWindow mw = App.Current.MainWindow as MainWindow;
             if (mw.isLoggedIn)
             {
                 DataSet d = new DataSet();
                 d.ComboWilaya.Text = WilayaName;
                 d.ShowDialog();
                 mb.Close();
             }
             else
             {
                 mb.messageErreur.Visibility = Visibility.Visible;
                 mb.messageErreur.Text       = "Vous n'etes pas un admin";
             }
         };
         mb.ShowDialog();
     }
     if (File.Exists(config.getWilaya(WilayaName).path))
     {
         InitializeComponent();
         date1.SelectedDate = date2.SelectedDate = DateTime.Today;
         this.WilayaName    = WilayaName;
         inputSynthese      = new InputSynthese(DateTime.Today, DateTime.Today, config.getWilaya(WilayaName).path);
         done = true;
     }
     else
     {
         Synthese synth = (App.Current.MainWindow as MainWindow).main.Content as Synthese;
         //synth.pageouverte = 0;
         //synth.Tableau.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#556060"));
         synth.ErreurMessage.Text       = "Le chemin de la wilaya " + WilayaName + "\n n'existe pas ";
         synth.contenuErreur.Visibility = Visibility.Visible;
     }
 }
Exemplo n.º 10
0
        public static bool?Show(string message, string detail, MessageBoxWindowType windowType, MessageBoxWindowButtonsType buttonType, string title)
        {
            MessageBoxWindow window = new MessageBoxWindow();

            window.Title       = title;
            window.Message     = message;
            window.Detail      = detail;
            window.WindowType  = windowType;
            window.ButtonsType = buttonType;

            return(window.ShowDialog());
        }
Exemplo n.º 11
0
        /// <summary>
        /// Load the IMG as Color 2byte list
        /// </summary>
        /// <param name="filename">The Filepath/Filenamee to load</param>
        /// <param name="width">The width from the IMG</param>
        /// <param name="height">The Height from the IMG</param>
        /// <param name="animatedColor">Needed if alpha is 0 or 1</param>
        /// <param name="pixelsize">Pixelsize of a pixel needed for Colortable</param>
        /// <returns></returns>
        internal static List <UInt16> LoadImage(String filename, ref int width, ref int height, int animatedColor = 1, int pixelsize = 1, uint type = 0, int offsetx = 0, int offsety = 0)
        {
            if (Logger.Loggeractiv)
            {
                Logger.Log("LoadImage");
            }
            List <UInt16> colors = new List <UInt16>();

            try
            {
                var image = Image.Load(filename);
                if (width == 0)
                {
                    width = image.Width;
                }
                if (height == 0)
                {
                    height = image.Height;
                }
                for (int y = offsety; y < height + offsety; y += pixelsize)
                {
                    for (int x = offsetx; x < width + offsetx; x += pixelsize) //Bgra8888
                    {
                        var  pixel = image[x, y];
                        byte a     = (animatedColor >= 1 ||
                                      ((GM1FileHeader.DataType)type) == GM1FileHeader.DataType.TilesObject ||
                                      ((GM1FileHeader.DataType)type) == GM1FileHeader.DataType.Animations ||
                                      ((GM1FileHeader.DataType)type) == GM1FileHeader.DataType.TGXConstSize ||
                                      ((GM1FileHeader.DataType)type) == GM1FileHeader.DataType.NOCompression ||
                                      ((GM1FileHeader.DataType)type) == GM1FileHeader.DataType.NOCompression1) ? byte.MaxValue : byte.MinValue;
                        if (pixel.A == 0)
                        {
                            colors.Add((ushort)32767);
                        }
                        else
                        {
                            colors.Add(EncodeColorTo2Byte((uint)(pixel.B | pixel.G << 8 | pixel.R << 16 | a << 24)));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (Logger.Loggeractiv)
                {
                    Logger.Log("Exception:\n" + e.Message);
                }
                MessageBoxWindow messageBox = new MessageBoxWindow(MessageBoxWindow.MessageTyp.Info, "Something went wrong: pls add a issue on the Github Page\n\nError:\n" + e.Message);
                messageBox.Show();
            }
            return(colors);
        }
Exemplo n.º 12
0
        public void AddNewGame()
        {
            var fullPath = "";
            var item     = SelectedItem;

            if (item != null)
            {
                fullPath = item.FullPath;
            }
            var path = "";

            AddGameOpenFileDialog.DefaultExt = ".exe";
            if (!string.IsNullOrEmpty(fullPath))
            {
                var fi = new System.IO.FileInfo(fullPath);
                if (string.IsNullOrEmpty(path))
                {
                    path = fi.Directory.FullName;
                }
                AddGameOpenFileDialog.FileName = fi.Name;
            }
            AddGameOpenFileDialog.Filter           = EngineHelper.GetFileDescription(".exe") + " (*.exe)|*.exe|All files (*.*)|*.*";
            AddGameOpenFileDialog.FilterIndex      = 1;
            AddGameOpenFileDialog.RestoreDirectory = true;
            if (string.IsNullOrEmpty(path))
            {
                path = System.IO.Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
            }
            AddGameOpenFileDialog.InitialDirectory = path;
            AddGameOpenFileDialog.Title            = "Browse for Executable";
            var result = AddGameOpenFileDialog.ShowDialog();

            if (result == true)
            {
                // Don't allow to add windows folder.
                var winFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Windows);
                if (AddGameOpenFileDialog.FileName.StartsWith(winFolder, StringComparison.OrdinalIgnoreCase))
                {
                    MessageBoxWindow.Show("Windows folders are not allowed.", "Windows Folder", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
                }
                else
                {
                    ScanStarted = DateTime.Now;
                    var success = System.Threading.ThreadPool.QueueUserWorkItem(ScanGames, AddGameOpenFileDialog.FileName);
                    if (!success)
                    {
                        ScanProgressLevel0Label.Text = "Scan failed!";
                        ScanProgressLevel1Label.Text = "";
                    }
                }
            }
        }
 private void LoginButton_Click(object sender, EventArgs e)
 {
     // Secure login over insecure web services.
     if (LoginButton.Text == "Log In")
     {
         var o           = SettingsManager.Options;
         var saveOptions = false;
         if (o.CheckAndFixUserRsaKeys())
         {
             SettingsManager.OptionsData.Save();
         }
         var ws  = new WebServiceClient();
         var url = InternetDatabaseUrlComboBox.Text;
         ws.Url = url;
         CloudMessage results;
         // If cloud RSA keys are missing then...
         if (string.IsNullOrEmpty(o.CloudRsaPublicKey))
         {
             // Step 1: Get Server's Public RSA key for encryption.
             var msg = new CloudMessage(CloudAction.GetPublicRsaKey);
             CloudHelper.ApplySecurity(msg);
             msg.Values.Add(CloudKey.RsaPublicKey, o.UserRsaPublicKey);
             // Retrieve public RSA key.
             results = ws.Execute(msg);
             if (results.ErrorCode == 0)
             {
                 o.CloudRsaPublicKey = results.Values.GetValue <string>(CloudKey.RsaPublicKey);
                 saveOptions         = true;
             }
         }
         if (saveOptions)
         {
             SettingsManager.OptionsData.Save();
         }
         var cmd2 = new CloudMessage(CloudAction.LogIn);
         CloudHelper.ApplySecurity(cmd2, o.UserRsaPublicKey, o.CloudRsaPublicKey, UsernameTextBox.Text, PasswordTextBox.Text);
         cmd2.Values.Add(CloudKey.ComputerId, o.ComputerId, true);
         cmd2.Values.Add(CloudKey.ProfileId, o.ProfileId, true);
         results = ws.Execute(cmd2);
         if (results.ErrorCode != 0)
         {
             MessageBoxWindow.Show(results.ErrorMessage, string.Format("{0} Result", CloudAction.LogIn), System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
         }
         else
         {
             MessageBoxWindow.Show(string.Format("Authorized: {0}", results.ErrorMessage), string.Format("{0} Result", CloudAction.LogIn), System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
         }
     }
     else
     {
     }
 }
Exemplo n.º 14
0
 private void SaveNewPassword(object obj)
 {
     if (ChangePassword())
     {
         ErrMsg = string.Empty;
         //MessageBoxWindow.Show("提示", "密码修改成功,请重新登录!", MessageBoxButton.OK, GlobalVariable.WarnOrSuccess.Success);
         //ChangePasswordSuccessEvent?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         MessageBoxWindow.Show("提示", ErrMsg, MessageBoxButton.OK, GlobalVariable.WarnOrSuccess.Warn);
     }
 }
        /// <summary>
        /// 删除硬广
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deletemenu_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Warning, "是否删除此硬广?");
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                AMS.ViewModel.ViewModelAdHardEditWindow vaew = new AMS.ViewModel.ViewModelAdHardEditWindow(HardAdLbox.Items[HardAdLbox.SelectedIndex] as AMS.Model.AMS_HardAd);
                vaew.Delete();
                DataBinging();
            }
        }
        private void deletemenu_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Warning, "是否删除这个客户?");
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                AMS.ViewModel.ViewModelCustomerEditWindow vmcw = new AMS.ViewModel.ViewModelCustomerEditWindow(CustomerLbox.Items[CustomerLbox.SelectedIndex] as AMS.Model.AMS_AdCustomer);
                vmcw.Delete();
                DataBinding();
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// 拒绝
 /// </summary>
 public void RefuseAudio()
 {
     if (!AntSdkService.AntSdkIsConnected)
     {
         MessageBoxWindow.Show("提示", "网络连接已断开,无法进行语音电话!", MessageBoxButton.OK, GlobalVariable.WarnOrSuccess.Warn);
         AudioChat._currentChannelId = 0;
         CloseWin();
         return;
     }
     AudioChat.AudioResult(ModelId, false);
     AudioChat._currentChannelId = 0;
     CloseWin();
 }
        public IMessageBoxWindow GetMessageBoxWindow(IVsUIShell uiShell)
        {
            var view = new MessageBoxWindow();

            IntPtr hwnd;

            uiShell.GetDialogOwnerHwnd(out hwnd);
            var windowInteropHelper = new WindowInteropHelper(view);

            windowInteropHelper.Owner = hwnd;

            return(view);
        }
Exemplo n.º 19
0
        internal unsafe static WriteableBitmap LoadImageAsBitmap(String filename, ref int width, ref int height, int offsetx = 0, int offsety = 0)
        {
            if (Logger.Loggeractiv)
            {
                Logger.Log("LoadImage");
            }
            var image = Image.Load(filename);

            if (width == 0)
            {
                width = image.Width;
            }
            if (height == 0)
            {
                height = image.Height;
            }
            WriteableBitmap bitmap = new WriteableBitmap(new PixelSize(width, height), new Vector(300, 300), Avalonia.Platform.PixelFormat.Rgba8888);

            using (var bit = bitmap.Lock())
            {
                try
                {
                    int xBit = 0, yBit = 0;
                    for (int y = offsety; y < height + offsety; y++)
                    {
                        for (int x = offsetx; x < width + offsetx; x++) //Bgra8888
                        {
                            var pixel = image[x, y];

                            var ptr = (uint *)bit.Address;
                            ptr += (uint)((bitmap.PixelSize.Width * yBit) + xBit);
                            *ptr = pixel.PackedValue;
                            xBit++;
                        }
                        xBit = 0;
                        yBit++;
                    }
                }
                catch (Exception e)
                {
                    if (Logger.Loggeractiv)
                    {
                        Logger.Log("Exception:\n" + e.Message);
                    }
                    MessageBoxWindow messageBox = new MessageBoxWindow(MessageBoxWindow.MessageTyp.Info, "Something went wrong: pls add a issue on the Github Page\n\nError:\n" + e.Message);
                    messageBox.Show();
                }
            }

            return(bitmap);
        }
Exemplo n.º 20
0
        private void deletemenu_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Warning, "是否删除这个地区?");
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                AMS.ViewModel.ViewModelProvinceEditWindow vmpew = new AMS.ViewModel.ViewModelProvinceEditWindow();
                vmpew.ProvinceModel = LBlsit.Items[LBlsit.SelectedIndex] as AMS.Model.AMS_Province;
                vmpew.Delete();
                DataBinding();
            }
        }
Exemplo n.º 21
0
        private void deletemenu_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Warning, "是否删除这个用户?");
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                AMS.ViewModel.ViewModelUserInfoEditWindow vmuiew = new AMS.ViewModel.ViewModelUserInfoEditWindow();
                vmuiew.UserModel = LBList.Items[LBList.SelectedIndex] as AMS.Model.AMS_UserInfo;
                vmuiew.Delete();
                vm_UserList.GetDataList();
            }
        }
        private void deletemenu_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Warning, "是否删除这个冠名广告?");
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                AMS.ViewModel.ViewModelRollTitlesEditWindow vmtw = new AMS.ViewModel.ViewModelRollTitlesEditWindow();
                vmtw.RollTitles = TitleAdLbox.Items[TitleAdLbox.SelectedIndex] as AMS.Model.AMS_RollTitles;
                vmtw.Del();
                DataBinding();
            }
        }
Exemplo n.º 23
0
		public MessageResult ShowMessage( ViewModelBase model, string title=null, string msg=null ) {

			MessageBoxWindow win = new MessageBoxWindow();

			bool? result = win.ShowMessage( title, msg );
			if( result == null ) {
				return MessageResult.Cancel;
			} else if( result == true ) {
				return MessageResult.Accept;
			}
			return MessageResult.Cancel;
			

		} //
Exemplo n.º 24
0
 /// <summary>
 ///  Displays a message box with Yes button
 /// </summary>
 /// <param name="message">The message to display</param>
 /// <param name="title">The title of the message box</param>
 public static void Show(string message, string title)
 {
     using (var msg = new MessageBoxWindow())
     {
         msg.TxtTitle.Text   = title;
         msg.TxtMessage.Text = message;
         msg.TitleBackgroundPanel.Background = new SolidColorBrush(Color.FromRgb(3, 169, 244));
         msg.BorderBrush          = new SolidColorBrush(Color.FromRgb(3, 169, 244));
         msg.BtnCancel.Visibility = Visibility.Collapsed;
         msg.BtnOk.Content        = "OK";
         msg.BtnOk.Focus();
         msg.ShowDialog();
     }
 }
        private void deletemenu_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Warning, "是否删除这个信息?");
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                MainPageInfo.ErrorCallBackWindow fbw = new ErrorCallBackWindow();
                fbw.vm_CallBackErrorInfoEditWindow.CallBackErrorModel = (FeedbackLbox.Items[FeedbackLbox.SelectedIndex] as AMS.ViewModel.ViewModelCallBackErrorInfoShow).CallBackErrorModel;
                fbw.vm_CallBackErrorInfoEditWindow.Delete();
                DataBinding();
            }
        }
        public MessageBoxResult Show(string msgText, string caption, MessageBoxButton button)
        {
            var vm  = new MessageBoxWindowViewModel(button, msgText, caption);
            var msg = new MessageBoxWindow {
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner,
                DataContext           = vm
            };

            if (ShellService.Current.Shell is System.Windows.Window shell && shell.IsLoaded)
            {
                msg.ShowInTaskbar = false;
                msg.Owner         = shell;
            }
            var res = msg.ShowDialog();

#if DEBUG
            ThreadInvoker.BackInvoke(() => {
                Thread.Sleep(1000);
                for (int i = 0; i < 10; i++)
                {
                    System.GC.Collect();
                    System.GC.WaitForPendingFinalizers();
                }
            });
#endif
            msg.DataContext = null;
            switch (vm.DialogResult)
            {
            case null:
                if (button == MessageBoxButton.YesNoCancel)
                {
                    return(MessageBoxResult.Cancel);
                }
                return(MessageBoxResult.None);

            case false:
                return(MessageBoxResult.No);

            case true:
                if (button == MessageBoxButton.OK)
                {
                    return(MessageBoxResult.OK);
                }
                return(MessageBoxResult.Yes);

            default:
                return(MessageBoxResult.None);
            }
        }
Exemplo n.º 27
0
 private void btn_Watch_Click(object sender, RoutedEventArgs e)
 {
     image = viewModel.GetBitmap();
     if (image != null)
     {
         image_Path.Fill = new ImageBrush(Imaging.CreateBitmapSourceFromHBitmap(image.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()));
     }
     else
     {
         MessageBoxWindow mbw = new MessageBoxWindow();
         mbw.viewModel.Message = "生成失败!";
         mbw.viewModel.Type    = Code.MessageBoxType.Error;
         mbw.ShowDialog();
     }
 }
Exemplo n.º 28
0
        private void ClearButton_Click(object sender, RoutedEventArgs e)
        {
            var description = Attributes.GetDescription(_MappedTo);
            var text        = string.Format("Do you want to clear all {0} settings?", description);
            var form        = new MessageBoxWindow();
            var result      = form.ShowDialog(text, "Clear Controller Settings", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }
            var ps = new PadSetting();

            _PadSetting.Load(ps);
        }
Exemplo n.º 29
0
        private void LoadTgxFile(string listboxItemBefore)
        {
            if (Logger.Loggeractiv)
            {
                Logger.Log("LoadGfxFile");
            }
            Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Wait);
            try
            {
                vm.ColorButtonsEnabled = false;
                vm.OrginalStrongholdAnimationButtonEnabled = false;
                vm.ActuellColorTable      = null;
                vm.ReplaceWithSaveFile    = false;
                vm.ButtonsEnabled         = false;
                vm.ImportButtonEnabled    = false;
                vm.TgxButtonExportEnabled = true;
                vm.ReplaceWithSaveFileTgx = false;
                vm.DecodeTgxData(listboxItemBefore, this);

                var filewithouttgxending = listboxItemBefore.Replace(".tgx", "");

                if (File.Exists(vm.UserConfig.WorkFolderPath + "\\" + filewithouttgxending + "\\" + filewithouttgxending + ".png"))
                {
                    vm.TgxButtonImportEnabled = true;
                }


                if (!File.Exists(vm.UserConfig.WorkFolderPath + "\\" + filewithouttgxending + "\\" + filewithouttgxending + "Save.tgx"))
                {
                    vm.ReplaceWithSaveFileTgx = false;
                }
                else
                {
                    vm.ReplaceWithSaveFileTgx = true;
                }
            }
            catch (Exception e)
            {
                if (Logger.Loggeractiv)
                {
                    Logger.Log("Exception:\n" + e.Message);
                }
                MessageBoxWindow messageBox = new MessageBoxWindow(MessageBoxWindow.MessageTyp.Info, "Something went wrong: pls add a issue on the Github Page\n\nError:\n" + e.Message);
                messageBox.Show();
            }

            Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Arrow);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Save_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxWindow mbw = new MessageBoxWindow();

            mbw.vm_MessageBoxWindow = new AMS.ViewModel.ViewModelMessageBoxWindow(AMS.Model.Enum.MessageBoxType.Ask,
                                                                                  string.Format("确定使用当前播放时间?"));
            mbw.ShowDialog();
            if (mbw.vm_MessageBoxWindow.Result)
            {
                pbw = new ProgressBarWindow(viewModel.Vm_ProgressBar);
                pbw.vm_Progress.Refresh();
                pbw.Show();
                Thread myThread = new Thread(new ThreadStart(Save));
                myThread.Start();
            }
        }
        /// <summary>
        /// Display a message-box to the user, based upon the given options.
        /// This particular method is the one that all of the other Notify methods invoke to do the actual work.
        /// </summary>
        /// <param name="options">a MessageBoxConfiguration object that fully specifies everything about the message-box</param>
        /// <returns>a MessageResult indicating which action the user took, or TimedOut if the user took no action before the timeout expired</returns>
        public MessageResult NotifyUser(IMessageBoxConfiguration options)
        {
            MessageBoxConfiguration configuration = options as MessageBoxConfiguration;

            var messageBoxWindow = new MessageBoxWindow(this, configuration);

            // If the developer who is calling this has provided a custom visual element
            // to show within the message-box, set that now.
            //CBL
            //if (_customElement != null)
            //{
            //    messageBoxWindow.SetCustomElement(_customElement);
            //}

            // If we are doing testing, and have specified that a specific button is to be emulated as having been selected by the user,
            // then verify that that button is indeed present..
            if (IsTesting)
            {
                if (TestFacility.ButtonResultToSelect.HasValue)
                {
                    string complaint;
                    if (!GetWhetherButtonIsIncluded(configuration.ButtonFlags, out complaint))
                    {
                        // Announce the error  
                        throw new ArgumentOutOfRangeException(complaint);
                    }
                }
            }

            //TODO: The following should not be needed for Silverlight..
            // Try to give it a parent-window to position itself relative to.
#if !SILVERLIGHT
            FrameworkElement parentElement = configuration.ParentElement;
            Window parentWindow = null;
            if (parentElement == null)
            {
                // When running unit-tests, Application.Current might be null.
                if (Application.Current != null)
                {
                    parentWindow = Application.Current.MainWindow;
                    // If the parent-window has not actually been shown yet, this would cause an exception.
                    if (parentWindow != null && parentWindow.IsLoaded)
                    {
                        messageBoxWindow.Owner = parentWindow;
                    }
                }
            }
            else if (parentElement.IsLoaded)
            {
                parentWindow = parentElement as Window;
                if (parentWindow != null)
                {
                    messageBoxWindow.Owner = parentWindow;
                }
            }
#endif

            // Finally, show the message-box.
            //TODO: for Silverlight, need to prepare to receive the result asynchronously!!!
#if SILVERLIGHT
            messageBox.Show();
#else
            _messageBoxWindow = messageBoxWindow;
            if (configuration.IsAsynchronous)
            {
                messageBoxWindow.Show();
            }
            else
            {
                messageBoxWindow.ShowDialog();
            }
#endif
            return messageBoxWindow.Result;
        }