예제 #1
0
        private async void InstallBthHostOnClick(object sender, RoutedEventArgs e)
        {
            MainBusyIndicator.IsBusy = !MainBusyIndicator.IsBusy;

            var  rebootRequired = false;
            uint result         = 0;
            var  bhInfPath      = Path.Combine(GlobalConfiguration.AppDirectory, "WinUSB", "BluetoothHost.inf");

            MainBusyIndicator.SetContentThreadSafe(Properties.Resources.BluetoothSetupInstalling);

            await Task.Run(() => result = Difx.Instance.Install(bhInfPath,
                                                                DifxFlags.DRIVER_PACKAGE_ONLY_IF_DEVICE_PRESENT | DifxFlags.DRIVER_PACKAGE_FORCE, out rebootRequired));

            MainBusyIndicator.IsBusy = !MainBusyIndicator.IsBusy;

            // ERROR_NO_SUCH_DEVINST = 0xE000020B
            if (result != 0 && result != 0xE000020B)
            {
                // display error message
                ExtendedMessageBox.Show(this,
                                        Properties.Resources.SetupFailedTitle,
                                        Properties.Resources.SetupFailedInstructions,
                                        Properties.Resources.SetupFailedContent,
                                        string.Format(Properties.Resources.SetupFailedVerbose,
                                                      new Win32Exception(Marshal.GetLastWin32Error()), Marshal.GetLastWin32Error()),
                                        Properties.Resources.SetupFailedFooter,
                                        TaskDialogIcon.Error);
                return;
            }

            // display success message
            ExtendedMessageBox.Show(this,
                                    Properties.Resources.SetupSuccessTitle,
                                    Properties.Resources.BluetoothSetupSuccessInstruction,
                                    Properties.Resources.SetupSuccessContent,
                                    string.Empty,
                                    string.Empty,
                                    TaskDialogIcon.Information);

            // display reboot required message
            if (rebootRequired)
            {
                MessageBox.Show(this,
                                Properties.Resources.RebootRequiredContent,
                                Properties.Resources.RebootRequiredTitle,
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
예제 #2
0
        /// <summary>
        /// Displays an extended message box.
        /// </summary>
        /// <param name="p_strMessage">The message to display.</param>
        /// <param name="p_strCaption">The caption of the message box.</param>
        /// <param name="p_strDetails">The details to display.</param>
        /// <param name="p_mbbButtons">The buttons to show on the message box.</param>
        /// <param name="p_mbiIcon">The icon to show on the message box.</param>
        /// <returns>The <see cref="DialogResult"/> corressponding to the button pushed on the message box.</returns>
        public DialogResult ShowExtendedMessageBox(string p_strMessage, string p_strCaption, string p_strDetails, MessageBoxButtons p_mbbButtons, MessageBoxIcon p_mbiIcon)
        {
            DialogResult drsResult = DialogResult.None;

            try
            {
                new PermissionSet(PermissionState.Unrestricted).Assert();
                SyncContext.Send(x => drsResult = ExtendedMessageBox.Show(null, p_strMessage, p_strCaption, p_strDetails, p_mbbButtons, p_mbiIcon), null);
            }
            finally
            {
                PermissionSet.RevertAssert();
            }
            return(drsResult);
        }
        private void Column_Click(object sender, CellClickEventArgs e)
        {
            if (e.Column == tlcRevert)
            {
                ModProfile Profile = (ModProfile)e.Model;

                if ((Profile.BackupDate != "") && (Profile.IsEdited))
                {
                    string strRevertWarning = "If you click YES, any changes you've made to this profile will be deleted and the profile will revert back to its original settings." + Environment.NewLine +
                                              "If you click NO, the current profile won't be touched and a new profile will be made with the original settings." + Environment.NewLine +
                                              "If you click CANCEL, this window will close and nothing will happen." + Environment.NewLine;

                    DialogResult drResult = ExtendedMessageBox.Show(this, strRevertWarning, "Revert", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                }
            }
        }
예제 #4
0
 private void PerformLoginAttempt()
 {
     if (this._inProgress || !this._isLoginButtonEnabled)
     {
         return;
     }
     this._inProgress = true;
     this.SetControlsState(false);
     Logger.Instance.Info("Trying to log in", new object[0]);
     this.ShowProgressIndicator(true, "");
     Logger.Instance.Info("Calling back end service", new object[0]);
     LoginService.Instance.GetAccessToken(this.textBoxUsername.Text, this.passwordBox.Password, delegate(BackendResult <AutorizationData, ResultCode> result)
     {
         Logger.Instance.Info("Back end service returned: " + result.ResultCode.ToString(), new object[0]);
         this.ShowProgressIndicator(false, "");
         ResultCode resultCode = result.ResultCode;
         if (resultCode != ResultCode.CommunicationFailed)
         {
             if (resultCode != ResultCode.Succeeded)
             {
                 if (resultCode != ResultCode.CaptchaControlCancelled)
                 {
                     Execute.ExecuteOnUIThread(delegate
                     {
                         ExtendedMessageBox.ShowSafe(AppResources.Login_Error_InvalidCredential, AppResources.Login_Error_Header);
                         this.SetControlsState(true);
                         this.passwordBox.Focus();
                     });
                 }
                 else
                 {
                     this.SetControlsState(true);
                 }
             }
             else
             {
                 ServiceLocator.Resolve <IAppStateInfo>().HandleSuccessfulLogin(result.ResultData, true);
             }
         }
         else
         {
             ExtendedMessageBox.ShowSafe(AppResources.FailedToConnect, AppResources.Login_Error_Header);
             this.SetControlsState(true);
         }
         this._inProgress = false;
     });
 }
        /// <summary>
        /// Displays a message.
        /// </summary>
        /// <param name="p_vwmMessage">The properties of the message to dislpay.</param>
        /// <returns>The return value of the displayed message.</returns>
        private object ShowMessage(ViewMessage p_vwmMessage)
        {
            if (InvokeRequired)
            {
                return(Invoke((ShowMessageDelegate)ShowMessage, p_vwmMessage));
            }
            if (String.IsNullOrEmpty(p_vwmMessage.Details))
            {
                bool booFound = true;
                MessageBoxButtons mbbOptions = MessageBoxButtons.OK;
                switch (p_vwmMessage.Options)
                {
                case ExtendedMessageBoxButtons.Abort | ExtendedMessageBoxButtons.Retry | ExtendedMessageBoxButtons.Ignore:
                    mbbOptions = MessageBoxButtons.AbortRetryIgnore;
                    break;

                case ExtendedMessageBoxButtons.OK:
                    mbbOptions = MessageBoxButtons.OK;
                    break;

                case ExtendedMessageBoxButtons.OK | ExtendedMessageBoxButtons.Cancel:
                    mbbOptions = MessageBoxButtons.OKCancel;
                    break;

                case ExtendedMessageBoxButtons.Retry | ExtendedMessageBoxButtons.Cancel:
                    mbbOptions = MessageBoxButtons.RetryCancel;
                    break;

                case ExtendedMessageBoxButtons.Yes | ExtendedMessageBoxButtons.No:
                    mbbOptions = MessageBoxButtons.YesNo;
                    break;

                case ExtendedMessageBoxButtons.Yes | ExtendedMessageBoxButtons.No | ExtendedMessageBoxButtons.Cancel:
                    mbbOptions = MessageBoxButtons.YesNoCancel;
                    break;

                default:
                    booFound = false;
                    break;
                }
                if (booFound)
                {
                    return(MessageBox.Show(this, p_vwmMessage.Message, p_vwmMessage.Title, mbbOptions, p_vwmMessage.MessageType));
                }
            }
            return(ExtendedMessageBox.Show(this, p_vwmMessage.Message, p_vwmMessage.Title, p_vwmMessage.Details, p_vwmMessage.Options, p_vwmMessage.MessageType));
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            ExtendedDialogResult LobjResult =
                ExtendedMessageBox.Show(textBox1.Text,
                                        textBox2.Text,
                                        (MessageBoxButtons)Enum.Parse(typeof(MessageBoxButtons), comboBox1.Text),
                                        (MessageBoxIcon)Enum.Parse(typeof(MessageBoxIcon), comboBox2.Text),
                                        textBoxCheck.Text,
                                        new Hyperlink(textBox4.Text, textBox3.Text),
                                        textBox5.Text,
                                        trackBar1.Value);

            textBoxResult.Text = "You clicked: " + LobjResult.Result.ToString() +
                                 (!string.IsNullOrEmpty(textBoxCheck.Text) ? "\r\nAnd the Checkbox was " +
                                  (LobjResult.IsChecked ? "checked" : "unchecked") : "") +
                                 (LobjResult.TimedOut?"\r\nAnd the dialog timed out on its own.":"");
        }
예제 #7
0
        /// <summary>
        /// Activates the given mod.
        /// </summary>
        /// <param name="p_modMod">The mod to activate.</param>
        public void ActivateMod(IMod p_modMod)
        {
            string strErrorMessage = ModManager.RequiredToolErrorMessage;

            if (String.IsNullOrEmpty(strErrorMessage))
            {
                IBackgroundTaskSet btsInstall = ModManager.ActivateMod(p_modMod, ConfirmModUpgrade, ConfirmItemOverwrite, ModManager.ActiveMods);
                if (btsInstall != null)
                {
                    ModManager.ActivateModsMonitor.AddActivity(btsInstall);
                }
            }
            else
            {
                ExtendedMessageBox.Show(ParentForm, strErrorMessage, "Required Tool not present", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #8
0
        public WindowKepgeneralas()
        {
            InitializeComponent();

            Bitmap = null;

            try
            {
                BeallitasokBetoltese();
            }
            catch (Exception ex)
            {
                ExtendedMessageBox.ShowError(ex.Message);
            }

            FillRectangle();
        }
예제 #9
0
        /// <summary>
        /// Handles the <see cref="PluginManagerVM.ImportSucceeded"/> event of the view model.
        /// </summary>
        /// <remarks>
        /// This displays a simple success message.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="EventArgs{String}"/> describing the event arguments.</param>
        private void ViewModel_ImportSucceeded(object sender, ImportSucceededEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke((Action <object, ImportSucceededEventArgs>)ViewModel_ImportSucceeded, sender, e);
                return;
            }

            System.Text.StringBuilder sbMessage = new System.Text.StringBuilder();
            string strDetails;

            sbMessage.Append("The load order was successfully imported from");

            FormatPluginCountsReport(e, ref sbMessage, out strDetails);

            ExtendedMessageBox.Show(this, sbMessage.ToString(), ViewModel.Settings.ModManagerName, strDetails, ExtendedMessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #10
0
        private void _appBarButtonSend_Click(object sender, EventArgs e)
        {
            string str1 = this.textBoxNewMessage.Text;

            if (this.ReplyAutoForm != null && str1.StartsWith(this.ReplyAutoForm))
            {
                string str2 = this.ReplyAutoForm.Remove(this.ReplyAutoForm.IndexOf(", "));
                string str3 = this._replyToUid > 0L ? "id" : "club";
                long   num  = this._replyToUid > 0L ? this._replyToUid : -this.PostCommentsVM.WallPostData.WallPost.owner_id;
                str1 = str1.Remove(0, this.ReplyAutoForm.Length).Insert(0, string.Format("[{0}{1}|{2}], ", str3, num, str2));
            }
            string text = str1.Replace("\r\n", "\r").Replace("\r", "\r\n");

            if (!this.PostCommentsVM.CanPostComment(text, (List <IOutboundAttachment>)Enumerable.ToList <IOutboundAttachment>(this._commentVM.OutboundAttachments), null))
            {
                return;
            }
            bool fromGroupChecked = this.ucNewMessage.FromGroupChecked;

            if (this._addingComment)
            {
                return;
            }
            this._addingComment = true;
            this.PostCommentsVM.PostComment(text, this._replyToCid, this._replyToUid, fromGroupChecked, (List <IOutboundAttachment>)Enumerable.ToList <IOutboundAttachment>(this._commentVM.OutboundAttachments), (Action <bool>)(result =>
            {
                this._addingComment = false;
                Execute.ExecuteOnUIThread((Action)(() =>
                {
                    if (!result)
                    {
                        ExtendedMessageBox.ShowSafe(CommonResources.Error);
                    }
                    else
                    {
                        this.textBoxNewMessage.Text = ("");
                        this.InitializeCommentVM();
                        this.UpdateAppBar();
                        this.ScrollToBottom();
                        this.textBoxNewMessage.Text = ("");
                        this.ResetReplyFields();
                    }
                }));
            }), null, "");
        }
예제 #11
0
        private void PerformLoginAttempt()
        {
            if (this._inProgress || !this._isLoginButtonEnabled)
            {
                return;
            }
            this._inProgress = true;
            this.SetControlsState(false);
            Logger.Instance.Info("Trying to log in");
            this.ShowProgressIndicator(true, "");
            Logger.Instance.Info("Calling back end service");
            //wtf
            Logger.Instance.Error("WTF " + this.textBoxUsername.Text + " " + this.passwordBox.Password);
            //
            LoginService.Instance.GetAccessToken(this.textBoxUsername.Text, this.passwordBox.Password, (Action <BackendResult <AutorizationData, ResultCode> >)(result =>
            {
                Logger.Instance.Info("Back end service returned: " + result.ResultCode.ToString());
                this.ShowProgressIndicator(false, "");
                switch (result.ResultCode)
                {
                case ResultCode.CommunicationFailed:
                    ExtendedMessageBox.ShowSafe(AppResources.FailedToConnect, AppResources.Login_Error_Header);
                    this.SetControlsState(true);
                    break;

                case ResultCode.Succeeded:
                    ServiceLocator.Resolve <IAppStateInfo>().HandleSuccessfulLogin(result.ResultData, true);
                    break;

                case ResultCode.CaptchaControlCancelled:
                    this.SetControlsState(true);
                    break;

                default:
                    Execute.ExecuteOnUIThread((Action)(() =>
                    {
                        ExtendedMessageBox.ShowSafe(AppResources.Login_Error_InvalidCredential, AppResources.Login_Error_Header);
                        this.SetControlsState(true);
                        this.passwordBox.Focus();
                    }));
                    break;
                }
                this._inProgress = false;
            }));
        }
예제 #12
0
        /// <summary>
        /// Checks if the ReadMe Manager has been properly initialized.
        /// </summary>
        public void CheckReadMeManager()
        {
            if ((this.ModManager.ManagedMods.Count > 0) && (!this.ModManager.ReadMeManager.IsInitialized))
            {
                string strMessage = string.Empty;
                if (ModManager.ReadMeManager.IsXMLCorrupt)
                {
                    strMessage = "An error occurred loading the ReadMeManager.xml file." + Environment.NewLine + Environment.NewLine;
                }

                strMessage += "NMM needs to setup the Readme Manager, this could take a few minutes depending on the number of mods and archive sizes.";
                strMessage += Environment.NewLine + "Do you want to perform the Readme Manager startup scan?";
                strMessage += Environment.NewLine + Environment.NewLine + "Note: if choose not to, you will be able to perform a scan by selecting any number of mods, and choosing 'Readme Scan' in the right-click menu.";

                if (ExtendedMessageBox.Show(null, strMessage, "Readme Manager Setup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SetupReadMeManager(ModManager.ManagedMods.ToList <IMod>());
                }
            }
        }
예제 #13
0
 private void MenuItemAdatRejtes_Click(object sender, RoutedEventArgs e)
 {
     if (!String.IsNullOrEmpty(TextBlockFilenev.Text))
     {
         try
         {
             AdatRejtes(TextBlockFilenev.Text, TextBoxPlainText.Text);
             ExtendedMessageBox.ShowInfo("Az adatrejtés sikeresen megtörtént!");
         }
         catch (Exception ex)
         {
             string errorMessage = String.Format("Hiba történt az adatrejtés során!{0}{1}", Environment.NewLine, ex.Message);
             ExtendedMessageBox.ShowError(errorMessage);
         }
     }
     else
     {
         ExtendedMessageBox.ShowError("Nincs megadva kép az adatrejtéshez!");
     }
 }
예제 #14
0
        /// <summary>
        /// Deactivates the given mod.
        /// </summary>
        /// <param name="p_modMod">The mod to deactivate.</param>
        protected void DeactivateMods(List <IMod> p_lstMod)
        {
            string strErrorMessage = ModManager.RequiredToolErrorMessage;

            if (String.IsNullOrEmpty(strErrorMessage))
            {
                foreach (IMod modMod in p_lstMod)
                {
                    IBackgroundTaskSet btsUninstall = ModManager.DeactivateMod(modMod, ModManager.ActiveMods);
                    if (btsUninstall != null)
                    {
                        ModManager.ActivateModsMonitor.AddActivity(btsUninstall);
                    }
                }
            }
            else
            {
                ExtendedMessageBox.Show(ParentForm, strErrorMessage, "Required Tool not present", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #15
0
        private void MenuItemOpenText_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.Title  = "Szövegfájl megnyitása";

            if (dlg.ShowDialog() == true)
            {
                try
                {
                    TextBoxPlainText.Text = File.ReadAllText(dlg.FileName, Encoding.GetEncoding("iso-8859-2"));
                }
                catch (Exception ex)
                {
                    string errorMessage = String.Format("Hiba történt a szövegfájl betöltése során!{0}{1}", Environment.NewLine, ex.Message);
                    ExtendedMessageBox.ShowError(errorMessage);
                }
            }
        }
예제 #16
0
 public void Handle(StickerItemTapEvent message)
 {
     if (!this._isCurrentPage || this._isAddingComment)
     {
         return;
     }
     this._isAddingComment = true;
     this.GroupDiscussionVM.AddComment("", this._commentVM.OutboundAttachments.ToList <IOutboundAttachment>(), (Action <bool>)(res =>
     {
         this._isAddingComment = false;
         Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (res)
             {
                 return;
             }
             ExtendedMessageBox.ShowSafe(CommonResources.Error);
         }));
     }), message.StickerItem, this.newCommentUC.FromGroupChecked, message.Referrer);
 }
예제 #17
0
        /// <summary>
        /// Activates the given mod.
        /// </summary>
        /// <param name="p_lstMod">The mods to activate.</param>
        public void ActivateMods(List <IMod> p_lstMod)
        {
            if (VirtualModActivator.MultiHDMode && !UacUtil.IsElevated)
            {
                MessageBox.Show("It looks like MultiHD mode is enabled but you're not running NMM as Administrator, you will be unable to install/activate mods or switch profiles." + Environment.NewLine + Environment.NewLine + "Close NMM and run it as Administrator to fix this.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string strMessage;
            bool   booRequiresConfig = ModManager.GameMode.RequiresExternalConfig(out strMessage);

            if (booRequiresConfig)
            {
                ExtendedMessageBox.Show(this.ParentForm, strMessage, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            string strErrorMessage = ModManager.RequiredToolErrorMessage;

            if (String.IsNullOrEmpty(strErrorMessage))
            {
                foreach (IMod modMod in p_lstMod)
                {
                    if (!ActiveMods.Contains(modMod))
                    {
                        IBackgroundTaskSet btsInstall = ModManager.ActivateMod(modMod, ConfirmModUpgrade, ConfirmItemOverwrite, ModManager.ActiveMods);
                        if (btsInstall != null)
                        {
                            ModManager.ModActivationMonitor.AddActivity(btsInstall);
                        }
                    }
                    else
                    {
                        EnableMod(modMod);
                    }
                }
            }
            else
            {
                ExtendedMessageBox.Show(ParentForm, strErrorMessage, "Required Tool not present", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #18
0
        private void MenuItemOpen_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Image files (JPG, PNG, BMP, TIF)|*.jpg;*.png;*.bmp;*.tif";
            dlg.Title  = "Kép megnyitása";

            if (dlg.ShowDialog() == true)
            {
                try
                {
                    KepBetoltese(dlg.FileName);
                    TextBlockFilenev.Text = dlg.FileName;
                }
                catch (Exception ex)
                {
                    string errorMessage = String.Format("Hiba történt a kép betöltése során!{0}{1}", Environment.NewLine, ex.Message);
                    ExtendedMessageBox.ShowError(errorMessage);
                }
            }
        }
예제 #19
0
        internal void PinToStart()
        {
            if ((this._group == null || string.IsNullOrWhiteSpace(this._group.name)) && string.IsNullOrWhiteSpace(this._prefetchedName))
            {
                return;
            }
            if (this._isLoading)
            {
                return;
            }
            this._isLoading = true;
            string smallPhoto = "";

            if (this._group != null && this._group.photo_200 != null)
            {
                smallPhoto = this._group.photo_200;
            }
            string name = "";

            if (!string.IsNullOrWhiteSpace(this._prefetchedName))
            {
                name = this._prefetchedName;
            }
            if (this._group != null)
            {
                name = this._group.name;
            }
            base.SetInProgress(true, "");
            SecondaryTileCreator.CreateTileFor(this._gid, true, name, delegate(bool res)
            {
                base.SetInProgress(false, "");
                this._isLoading = false;
                if (!res)
                {
                    Action arg_35_0 = new Action(() => { ExtendedMessageBox.ShowSafe(CommonResources.Error); });

                    Execute.ExecuteOnUIThread(arg_35_0);
                }
            }, smallPhoto);
        }
예제 #20
0
        private void MenuItemTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;
            DependencyObject dependencyObject = (DependencyObject)frameworkElement;

            while (!(dependencyObject is ContextMenu))
            {
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
            }
            ContextMenu contextMenu = dependencyObject as ContextMenu;
            int         num         = 0;

            contextMenu.IsOpen = num != 0;
            ConversationHeader dataContext1 = ((FrameworkElement)contextMenu).DataContext as ConversationHeader;

            if (!(frameworkElement.DataContext is MenuItemData))
            {
                return;
            }
            MenuItemData dataContext2 = frameworkElement.DataContext as MenuItemData;

            if (dataContext2.Tag == "delete")
            {
                this.DeleteConversation(dataContext1);
            }
            if (!(dataContext2.Tag == "disableEnable"))
            {
                return;
            }
            this.ConversationsVM.SetInProgressMain(true, "");
            dataContext1.DisableEnableNotifications((Action <bool>)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                this.ConversationsVM.SetInProgressMain(false, "");
                if (res)
                {
                    return;
                }
                ExtendedMessageBox.ShowSafe(CommonResources.Error);
            }))));
        }
예제 #21
0
        private void InstallBthHostOnClick(object sender, RoutedEventArgs e)
        {
            var bthResult = WdiErrorCode.WDI_SUCCESS;

            var bthToInstall =
                BluetoothStackPanelDefault.Children.Cast <TextBlock>()
                .Select(c => c.Tag)
                .Cast <WdiDeviceInfo>()
                .ToList();

            if (bthToInstall.Any())
            {
                bthResult = DriverInstaller.InstallBluetoothHost(bthToInstall.First(), _hWnd);
            }

            // display success or failure message
            if (bthResult == WdiErrorCode.WDI_SUCCESS)
            {
                ExtendedMessageBox.Show(this,
                                        Properties.Resources.BthInstOk_Title,
                                        Properties.Resources.BthInstOk_Instruction,
                                        Properties.Resources.BthInstOk_Content,
                                        Properties.Resources.BthInstOk_Verbose,
                                        Properties.Resources.BthInstOk_Footer,
                                        TaskDialogIcon.Information);
            }
            else
            {
                ExtendedMessageBox.Show(this,
                                        Properties.Resources.DsInstError_Title,
                                        Properties.Resources.DsInstError_Instruction,
                                        Properties.Resources.DsInstError_Content,
                                        string.Format(Properties.Resources.DsInstError_Verbose,
                                                      WdiWrapper.Instance.GetErrorMessage(bthResult), bthResult),
                                        Properties.Resources.DsInstError_Footer,
                                        TaskDialogIcon.Error);
            }
        }
예제 #22
0
 public static void PlayVideo(VKClient.Common.Backend.DataObjects.Video video, Action callback, int resolution, StatisticsActionSource actionSource = StatisticsActionSource.news, string videoContext = "")
 {
     if ((video != null ? video.files :  null) == null || video.files.Count == 0)
     {
         callback.Invoke();
         ExtendedMessageBox.ShowSafe(video == null || video.processing != 0 ? CommonResources.ProcessingVideoError : CommonResources.Conversation_VideoIsNotAvailable);
     }
     else
     {
         bool   isExternal;
         string uri = VideoPlayerHelper.GetVideoUri(video, resolution, out isExternal);
         if (string.IsNullOrEmpty(uri))
         {
             callback.Invoke();
             ExtendedMessageBox.ShowSafe(video.processing == 0 ? CommonResources.Conversation_VideoIsNotAvailable : CommonResources.ProcessingVideoError);
         }
         else
         {
             EventAggregator current        = EventAggregator.Current;
             VideoPlayEvent  videoPlayEvent = new VideoPlayEvent();
             videoPlayEvent.Position = StatisticsVideoPosition.start;
             int num1 = resolution;
             videoPlayEvent.quality = num1;
             string globallyUniqueId = video.GloballyUniqueId;
             videoPlayEvent.id = globallyUniqueId;
             int num2 = (int)actionSource;
             videoPlayEvent.Source = (StatisticsActionSource)num2;
             string str = videoContext;
             videoPlayEvent.Context = str;
             current.Publish(videoPlayEvent);
             ThreadPool.QueueUserWorkItem((WaitCallback)(o =>
             {
                 Thread.Sleep(500);
                 VideoPlayerHelper.PlayVideo(uri, isExternal, resolution, callback);
             }));
         }
     }
 }
        /// <summary>
        /// Hanldes the <see cref="Control.MouseClick"/> event of the controls.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="MouseEventArgs"/> describing the event arguments.</param>
        private void ModActivationMonitorControl_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ContextMenu m = new ContextMenu();
                m.MenuItems.Clear();
                m.MenuItems.Add(new MenuItem("Copy to clipboard", new EventHandler(cmsContextMenu_Copy)));
                m.Show((Control)(sender), e.Location);
            }
            else if (e.Button == MouseButtons.Left)
            {
                ListViewItem lvItem = lvwActiveTasks.GetItemAt(e.X, e.Y);

                if (lvItem == null)
                {
                    return;
                }
                ListViewItem.ListViewSubItem subItem = lvItem.GetSubItemAt(e.X, e.Y);
                if (subItem == null)
                {
                    return;
                }
                if (subItem.Name == "?")
                {
                    if (subItem.Text != string.Empty)
                    {
                        if ((m_strPopupErrorMessageType == "Error") || (String.IsNullOrEmpty(m_strPopupErrorMessageType)))
                        {
                            ExtendedMessageBox.Show(this, subItem.Text, "Failed", m_strDetailsErrorMessageType, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else if (m_strPopupErrorMessageType == "Warning")
                        {
                            ExtendedMessageBox.Show(this, subItem.Text, "Warning", m_strDetailsErrorMessageType, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
예제 #24
0
        public async void UploadDocument(StorageFile file)
        {
            Stream stream = ((IInputStream)await file.OpenAsync((FileAccessMode)0)).AsStreamForRead();
            Action <BackendResult <Doc, ResultCode> > callback = (Action <BackendResult <Doc, ResultCode> >)(result =>
            {
                this.SetInProgress(false, "");
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    Execute.ExecuteOnUIThread((Action)(() => EventAggregator.Current.Publish((object)new DocumentUploadedEvent()
                    {
                        OwnerId = this.OwnerId,
                        Document = result.ResultData
                    })));
                }
                else
                {
                    ExtendedMessageBox.ShowSafe(CommonResources.Error_Generic, CommonResources.Error);
                }
            });

            this.SetInProgress(true, "");
            DocumentsService.Current.UploadDocument(this.OwnerId >= 0L ? 0L : -this.OwnerId, file.Name, file.FileType, stream, callback, (Action <double>)null, (Cancellation)null);
        }
예제 #25
0
        /// <summary>
        /// Handles the <see cref="PluginManagerVM.ExportSucceeded"/> event of the view model.
        /// </summary>
        /// <remarks>
        /// This displays a simple success message.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="EventArgs{String}"/> describing the event arguments.</param>
        private void ViewModel_ExportSucceeded(object sender, ExportSucceededEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke((Action <object, ExportSucceededEventArgs>)ViewModel_ExportSucceeded, sender, e);
                return;
            }

            string message = "The current load order was successfully exported to";

            if (string.IsNullOrEmpty(e.Filename))
            {
                message += " the clipboard.";
            }
            else
            {
                message += ":" + Environment.NewLine + Environment.NewLine + e.Filename;
            }

            string details = string.Format("{0} {1} successfully exported.", e.ExportedPluginCount, (e.ExportedPluginCount == 1) ? "plugin was" : "plugins were");

            ExtendedMessageBox.Show(this, message, ViewModel.Settings.ModManagerName, details.ToString(), ExtendedMessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #26
0
        private async void InstallWindowsServiceOnClick(object sender, RoutedEventArgs e)
        {
            MainBusyIndicator.IsBusy = !MainBusyIndicator.IsBusy;
            var failed         = false;
            var rebootRequired = false;

            await Task.Run(() =>
            {
                try
                {
                    MainBusyIndicator.SetContentThreadSafe(Properties.Resources.ServiceSetupInstalling);

                    IDictionary state = new Hashtable();
                    var service       =
                        new AssemblyInstaller(Path.Combine(GlobalConfiguration.AppDirectory, "ScpService.exe"), null);

                    state.Clear();
                    service.UseNewContext = true;

                    service.Install(state);
                    service.Commit(state);

                    if (StartService(Settings.Default.ScpServiceName))
                    {
                        Log.InfoFormat("{0} started", Settings.Default.ScpServiceName);
                    }
                    else
                    {
                        rebootRequired = true;
                    }
                }
                catch (Win32Exception w32Ex)
                {
                    switch (w32Ex.NativeErrorCode)
                    {
                    case 1073:     // ERROR_SERVICE_EXISTS
                        Log.Info("Service already exists");
                        break;

                    default:
                        Log.ErrorFormat("Win32-Error during installation: {0}", w32Ex);
                        failed = true;
                        break;
                    }
                }
                catch (InvalidOperationException iopex)
                {
                    Log.ErrorFormat("Error during installation: {0}", iopex.Message);
                    failed = true;
                }
                catch (Exception ex)
                {
                    Log.ErrorFormat("Error during installation: {0}", ex);
                    failed = true;
                }
            });

            MainBusyIndicator.IsBusy = !MainBusyIndicator.IsBusy;

            // display error message
            if (failed)
            {
                ExtendedMessageBox.Show(this,
                                        Properties.Resources.SetupFailedTitle,
                                        Properties.Resources.SetupFailedInstructions,
                                        Properties.Resources.SetupFailedContent,
                                        string.Format(Properties.Resources.SetupFailedVerbose,
                                                      new Win32Exception(Marshal.GetLastWin32Error()), Marshal.GetLastWin32Error()),
                                        Properties.Resources.SetupFailedFooter,
                                        TaskDialogIcon.Error);
                return;
            }

            // display success message
            ExtendedMessageBox.Show(this,
                                    Properties.Resources.SetupSuccessTitle,
                                    Properties.Resources.ServiceSetupSuccessInstruction,
                                    Properties.Resources.ServiceSetupSuccessContent,
                                    string.Empty,
                                    string.Empty,
                                    TaskDialogIcon.Information);

            // display reboot required message
            if (rebootRequired)
            {
                MessageBox.Show(this,
                                Properties.Resources.RebootRequiredContent,
                                Properties.Resources.RebootRequiredTitle,
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
예제 #27
0
		public void ShowAssemblyMissingWarning(string assemblyPath)
		{
			if (!Project.Instance.IsAssemblyLoaded(assemblyPath))
			{
				bool loadAssembly = false;

				if (LoadUnloadedAssembly == ExtendedDialogResult.YesToAll)
				{
					loadAssembly = true;
				}
				else if (LoadUnloadedAssembly != ExtendedDialogResult.NoToAll)
				{
					Activate();
					string message = string.Format("The following assembly is not loaded: {0}\r\n\r\nWould you like to load it now?\r\n\r\nNote: if an assembly is not loaded in DILE then during the debugging you might not see correct call stack/object values as DILE will have not have enough information about the debuggee.", assemblyPath);

					ExtendedMessageBox messageBox = new ExtendedMessageBox();
					messageBox.ShowMessage("DILE - Load assembly?", message);
					LoadUnloadedAssembly = messageBox.ExtendedDialogResult;

					if (LoadUnloadedAssembly == ExtendedDialogResult.Yes || LoadUnloadedAssembly == ExtendedDialogResult.YesToAll)
					{
						loadAssembly = true;
					}
				}

				if (loadAssembly)
				{
					AssemblyLoader.Instance.Start(new string[] { assemblyPath });
				}
			}
		}
예제 #28
0
        public override bool CheckSecondaryUninstall(string p_strFileName)
        {
            if (p_strFileName.Contains("content.xml"))
            {
                try
                {
                    var    xdocContentXml   = XDocument.Load(Path.Combine(InstallationPath, p_strFileName));
                    var    strModName       = xdocContentXml.Root.Attribute("name").Value;
                    var    strSaveAttribute = xdocContentXml.Root.Attribute("save");
                    string strSaveValue     = null;
                    if (strSaveAttribute != null)
                    {
                        strSaveValue = strSaveAttribute.Value;
                    }

                    if (string.IsNullOrEmpty(strSaveValue) || strSaveValue.Equals("true") || strSaveValue.Equals("1"))
                    {
                        DialogResult drResult = DialogResult.None;
                        try
                        {
                            ThreadStart actShowMessage =
                                () =>
                                drResult =
                                    ExtendedMessageBox.Show(null,
                                                            string.Format(
                                                                "The author of the {0} mod has chosen that his mod should get recorded in your save games.\nIf you played the game while this mod was active, your save files may no longer work.\nDo you want to continue?",
                                                                strModName), "Warning", MessageBoxButtons.YesNo,
                                                            MessageBoxIcon.Exclamation);

                            ApartmentState astState = ApartmentState.Unknown;
                            Thread.CurrentThread.TrySetApartmentState(astState);
                            if (astState == ApartmentState.STA)
                            {
                                actShowMessage();
                            }
                            else
                            {
                                var thdMessage = new Thread(actShowMessage);
                                thdMessage.SetApartmentState(ApartmentState.STA);
                                thdMessage.Start();
                                thdMessage.Join();

                                if (drResult == DialogResult.No)
                                {
                                    return(true);
                                }
                            }
                        }
                        catch (Exception)
                        {
                            drResult = MessageBox.Show(string.Format(
                                                           "The author of the {0} mod has choosen that his mod should get recorded in your save games.\nIf you played the game while this mod was active, your save files may no longer work.\nDo you want to continue?",
                                                           strModName), "Warning", MessageBoxButtons.YesNo,
                                                       MessageBoxIcon.Exclamation);
                            if (drResult == DialogResult.No)
                            {
                                return(true);
                            }
                        }
                    }
                }
                catch
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #29
0
        /// <summary>
        /// Activates the given mod.
        /// </summary>
        /// <param name="p_lstMod">The mods to activate.</param>
        public void ActivateMods(List <IMod> p_lstMod)
        {
            if (VirtualModActivator.MultiHDMode && !UacUtil.IsElevated)
            {
                MessageBox.Show("It looks like MultiHD mode is enabled but you're not running NMM as Administrator, you will be unable to install/activate mods or switch profiles." + Environment.NewLine + Environment.NewLine + "Close NMM and run it as Administrator to fix this.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string strMessage;
            bool   booRequiresConfig = ModManager.GameMode.RequiresExternalConfig(out strMessage);

            if (booRequiresConfig)
            {
                ExtendedMessageBox.Show(this.ParentForm, strMessage, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            string strErrorMessage = ModManager.RequiredToolErrorMessage;

            if (string.IsNullOrEmpty(strErrorMessage))
            {
                foreach (IMod modMod in p_lstMod)
                {
                    if (!ActiveMods.Contains(modMod))
                    {
                        ModMatcher mmcMatcher    = new ModMatcher(ModManager.InstallationLog.ActiveMods, true);
                        IMod       modOldVersion = mmcMatcher.FindAlternateVersion(modMod, true);

                        if (modOldVersion != null)
                        {
                            string strUpgradeMessage = "A different version of {0} has been detected. The installed version is {1}, the new version is {2}. Would you like to upgrade?" + Environment.NewLine + "Selecting No will install the new Mod normally.";
                            strUpgradeMessage = String.Format(strUpgradeMessage, modOldVersion.ModName, modOldVersion.HumanReadableVersion, modMod.HumanReadableVersion);
                            switch (MessageBox.Show(strUpgradeMessage, "Upgrade", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
                            {
                            case DialogResult.Yes:
                                ReinstallMod(modOldVersion, modMod);
                                break;

                            case DialogResult.No:
                                IBackgroundTaskSet btsInstall = ModManager.ActivateMod(modMod, ConfirmModUpgrade, ConfirmItemOverwrite, ModManager.ActiveMods);
                                if (btsInstall != null)
                                {
                                    ModManager.ModActivationMonitor.AddActivity(btsInstall);
                                }
                                break;

                            case DialogResult.Cancel:
                                break;

                            default:
                                break;
                            }
                        }
                        else
                        {
                            IBackgroundTaskSet btsInstall = ModManager.ActivateMod(modMod, ConfirmModUpgrade, ConfirmItemOverwrite, ModManager.ActiveMods);
                            if (btsInstall != null)
                            {
                                ModManager.ModActivationMonitor.AddActivity(btsInstall);
                            }
                        }
                    }
                    else
                    {
                        EnableMod(modMod);
                    }
                }
            }
            else
            {
                ExtendedMessageBox.Show(ParentForm, strErrorMessage, "Required Tool not present", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #30
0
        /// <summary>
        /// This lets the user know a problem has occurred, and logs the exception.
        /// </summary>
        /// <param name="ex">The exception that is being handled.</param>
        private static void HandleException(Exception ex)
        {
            HeaderlessTextWriterTraceListener htlListener = (HeaderlessTextWriterTraceListener)Trace.Listeners["DefaultListener"];
            DialogResult drResult = DialogResult.No;

            Trace.WriteLine("");
            Trace.TraceError("Tracing an Unhandled Exception:");
            TraceUtil.TraceException(ex);

            if (!htlListener.TraceIsForced)
            {
                htlListener.SaveToFile();
            }

            StringBuilder stbPromptMessage = new StringBuilder();

            stbPromptMessage.AppendFormat("{0} has encountered an error and needs to close.", EnvironmentInfo.Settings.ModManagerName).AppendLine();
            stbPromptMessage.AppendLine("A Trace Log file was created at:");
            stbPromptMessage.AppendLine(htlListener.FilePath);
            stbPromptMessage.AppendLine("Before reporting the issue, don't close this window and check for a fix here (you can close it afterwards):");
            stbPromptMessage.AppendLine(NexusLinks.FAQs);
            stbPromptMessage.AppendLine("If you can't find a solution, please make a bug report and attach the TraceLog file here:");
            stbPromptMessage.AppendLine(NexusLinks.Issues);
            stbPromptMessage.AppendLine(Environment.NewLine + "Do you want to open the TraceLog folder?");
            try
            {
                //the extended message box contains an activex control wich must be run in an STA thread,
                // we can't control what thread this gets called on, so create one if we need to
                string      strException   = "The following information is in the Trace Log:" + Environment.NewLine + TraceUtil.CreateTraceExceptionString(ex);
                ThreadStart actShowMessage = () => drResult = ExtendedMessageBox.Show(null, stbPromptMessage.ToString(), "Error", strException, MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                ApartmentState astState = ApartmentState.Unknown;
                Thread.CurrentThread.TrySetApartmentState(astState);
                if (astState == ApartmentState.STA)
                {
                    actShowMessage();
                }
                else
                {
                    Thread thdMessage = new Thread(actShowMessage);
                    thdMessage.SetApartmentState(ApartmentState.STA);
                    thdMessage.Start();
                    thdMessage.Join();
                    if (drResult == DialogResult.Yes)
                    {
                        try
                        {
                            System.Diagnostics.Process prc = new System.Diagnostics.Process();
                            prc.StartInfo.FileName = Path.GetDirectoryName(htlListener.FilePath);
                            prc.Start();
                        }
                        catch { }
                    }
                }
            }
            catch
            {
                //backup, in case on extended message box starts to act up
                MessageBox.Show(stbPromptMessage.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #31
0
        private void InstallDsOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            WdiErrorCode ds3Result = WdiErrorCode.WDI_SUCCESS, ds4Result = WdiErrorCode.WDI_SUCCESS;

            var ds3SToInstall =
                DualShockStackPanelHidUsb.Children.Cast <TextBlock>()
                .Select(c => c.Tag)
                .Cast <WdiDeviceInfo>()
                .Where(d => d.VendorId == _hidUsbDs3.VendorId && d.ProductId == _hidUsbDs3.ProductId)
                .ToList();

            if (ds3SToInstall.Any())
            {
                ds3Result = DriverInstaller.InstallDualShock3Controller(ds3SToInstall.First(), _hWnd);
            }

            var ds4SToInstall =
                DualShockStackPanelHidUsb.Children.Cast <TextBlock>()
                .Select(c => c.Tag)
                .Cast <WdiDeviceInfo>()
                .Where(d => d.VendorId == _hidUsbDs4.VendorId && d.ProductId == _hidUsbDs4.ProductId)
                .ToList();

            if (ds4SToInstall.Any())
            {
                ds4Result = DriverInstaller.InstallDualShock4Controller(ds4SToInstall.First(), _hWnd);
            }

            // display success or failure message
            if (ds3Result == WdiErrorCode.WDI_SUCCESS && ds4Result == WdiErrorCode.WDI_SUCCESS)
            {
                ExtendedMessageBox.Show(this,
                                        Properties.Resources.DsInstOk_Title,
                                        Properties.Resources.DsInstOk_Instruction,
                                        Properties.Resources.DsInstOk_Content,
                                        Properties.Resources.DsInstOk_Verbose,
                                        Properties.Resources.DsInstOk_Footer,
                                        TaskDialogIcon.Information);
            }
            else
            {
                if (ds3Result != WdiErrorCode.WDI_SUCCESS)
                {
                    ExtendedMessageBox.Show(this,
                                            Properties.Resources.DsInstError_Title,
                                            Properties.Resources.DsInstError_Instruction,
                                            Properties.Resources.DsInstError_Content,
                                            string.Format(Properties.Resources.DsInstError_Verbose,
                                                          WdiWrapper.Instance.GetErrorMessage(ds3Result), ds3Result),
                                            Properties.Resources.DsInstError_Footer,
                                            TaskDialogIcon.Error);
                    return;
                }

                if (ds4Result != WdiErrorCode.WDI_SUCCESS)
                {
                    ExtendedMessageBox.Show(this,
                                            Properties.Resources.DsInstError_Title,
                                            Properties.Resources.DsInstError_Instruction,
                                            Properties.Resources.DsInstError_Content,
                                            string.Format(Properties.Resources.DsInstError_Verbose,
                                                          WdiWrapper.Instance.GetErrorMessage(ds4Result), ds4Result),
                                            Properties.Resources.DsInstError_Footer,
                                            TaskDialogIcon.Error);
                }
            }
        }