コード例 #1
0
        private void BuyAppForSyncBoxDismissed(object sender, DismissedEventArgs e)
        {
            if (!e.Result.Equals(CustomMessageBoxResult.LeftButton)) return;

            var buyAppTask = new MarketplaceDetailTask();
            buyAppTask.Show();
        }
コード例 #2
0
 private void AddDismissed(object sender, DismissedEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.LeftButton)
     {
         GetViewModel().Add();
     }
 }
コード例 #3
0
        /// <summary>
        /// Dismisses the message box.
        /// </summary>
        /// <param name="source">
        /// The source that caused the dismission.
        /// </param>
        /// <param name="useTransition">
        /// If true, the message box is dismissed after swiveling
        /// backward and out.
        /// </param>
        private void Dismiss(CustomMessageBoxResult source, bool useTransition)
        {
            // Ensure only a single Dismiss is being handled at a time
            if (_isBeingDismissed)
            {
                return;
            }
            _isBeingDismissed = true;

            // Handle the dismissing event.
            var handlerDismissing = Dismissing;

            if (handlerDismissing != null)
            {
                DismissingEventArgs args = new DismissingEventArgs(source);
                handlerDismissing(this, args);

                if (args.Cancel)
                {
                    _isBeingDismissed = false;
                    return;
                }
            }

            // Handle the dismissed event.
            var handlerDismissed = Dismissed;

            if (handlerDismissed != null)
            {
                DismissedEventArgs args = new DismissedEventArgs(source);
                handlerDismissed(this, args);
            }

            // Set the current instance to null.
            _currentInstance = null;

            // Cache this variable to avoid a race condition.
            bool restoreOriginalValues = _mustRestore;

            // Close popup.
            if (useTransition)
            {
                SwivelTransition backwardOut = new SwivelTransition {
                    Mode = SwivelTransitionMode.BackwardOut
                };
                ITransition swivelTransition = backwardOut.GetTransition(this);
                swivelTransition.Completed += (s, e) =>
                {
                    swivelTransition.Stop();
                    ClosePopup(restoreOriginalValues);
                };
                swivelTransition.Begin();
            }
            else
            {
                ClosePopup(restoreOriginalValues);
            }

            _isBeingDismissed = false;
        }
コード例 #4
0
 void custMsgBox_Dismissed(object sender, DismissedEventArgs e)
 {
     GoogleAnalytics.EasyTracker.GetTracker().SendEvent("sounds", "changed", (string)((CustomMessageBox)sender).Tag, 0);
     if (e.Result == CustomMessageBoxResult.RightButton)
     {
         try
         {
             HomebrewHelperWP.Registry.WriteString(RegistryHive.HKLM, @"SOFTWARE\Microsoft\EventSounds\Sounds\" + ((CustomMessageBox)sender).Tag, "Sound", ((RingtoneChooser)((CustomMessageBox)sender).Content).SelectedRingtone);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Failed: " + ex.Message);
         }
     }
 }
コード例 #5
0
		void cmb_Dismissed(object sender, DismissedEventArgs e)
		{
			switch (e.Result)
			{
				case CustomMessageBoxResult.LeftButton:
					{
						if (string.IsNullOrEmpty(_currentAccountData.Login.Text)) return;
						if (string.IsNullOrEmpty(_currentAccountData.Name.Text)) return;
						if (string.IsNullOrEmpty(_currentAccountData.Password.Text)) return;
						if (_currentAccountData.IsEdit)
						{
							Account editAccount = PassHoslder.SelectedItem as Account;
							editAccount.Name = _currentAccountData.Name.Text;
							editAccount.Login = _currentAccountData.Login.Text;
							editAccount.Password = _currentAccountData.Password.Text;
						}
						else
						{
							Account a = new Account();
							a.Login = _currentAccountData.Login.Text;
							a.Name = _currentAccountData.Name.Text;
							a.Password = _currentAccountData.Password.Text;
							_accounts.Add(a);
						}						
						SaveAccounts();
                        HandleOneDriveBehaviour();                               
                        
					}
					break;
				case CustomMessageBoxResult.RightButton:				
					break;
				default:
					break;
			}
			
			PassHoslder.SelectedItem = null;
			_dialogIsShow = false;
		}
コード例 #6
0
ファイル: Regedit.xaml.cs プロジェクト: jessenic/wph-tweaks
 void cmb_Dismissed(object sender, DismissedEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.LeftButton)
     {
         var cmb = sender as CustomMessageBox;
         var elem = cmb.Tag as RegistryEntryViewModel;
         var sp = cmb.Content as StackPanel;
         var textbox = (from child in sp.Children
                        where child is TextBox && ((TextBox)child).Name.Equals("ValueBox", StringComparison.OrdinalIgnoreCase)
                        select (TextBox)child).FirstOrDefault();
         if (textbox != null)
         {
             switch (elem.Value.Type)
             {
                 case RegistryType.String:
                     Registry.WriteString(RegistryHive.HKLM, elem.FullPath, elem.ElementName, textbox.Text);
                     break;
                 case RegistryType.Integer:
                     Registry.WriteDWORD(RegistryHive.HKLM, elem.FullPath, elem.ElementName, uint.Parse(textbox.Text));
                     break;
             }
         }
     }
 }
コード例 #7
0
		private void OnCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
		{
			CustomMessageBox cmb = (CustomMessageBox)sender;

			// Unregisters events.
			UnregisterEventHandlers(cmb);

			// Looks the corresponding wherigo message box up in the dictionary, and 
			// gives it a result depending on the custom message box result.
			WF.Player.Core.MessageBox wmb;
			if (_WherigoMessageBoxes.TryGetValue(cmb, out wmb))
			{
				// Bye bye box.
				_WherigoMessageBoxes.Remove(cmb);
				
				switch (e.Result)
				{
					case CustomMessageBoxResult.LeftButton:
						wmb.GiveResult(WF.Player.Core.MessageBoxResult.FirstButton);
						break;

					case CustomMessageBoxResult.RightButton:
						wmb.GiveResult(WF.Player.Core.MessageBoxResult.SecondButton);
						break;

					case CustomMessageBoxResult.None:
						// TODO: Keep track of lost message boxes.
						System.Diagnostics.Debug.WriteLine("Dismissed message box with no result: " + wmb.Text);

						wmb.GiveResult(WF.Player.Core.MessageBoxResult.Cancel);
						break;

					default:
						throw new InvalidOperationException("Unknown value of CustomMessageBoxResult cannot be processed: " + e.Result.ToString());
				}
			}

		} 
コード例 #8
0
        /// <summary>
        /// Closes the pop up.
        /// </summary>
        private void ClosePopup(bool restoreOriginalValues, CustomMessageBoxResult source)
        {
            // Remove the popup.
            if (_popup != null)
            {
                _popup.IsOpen = false;
                _popup = null;
            }

            // If there is no other message box displayed.  
            if (restoreOriginalValues)
            {
                // Set the system tray back to its original 
                // color nad opacity if necessary.
                if (SystemTray.IsVisible)
                {
                    SystemTray.BackgroundColor = _systemTrayColor;
                    SystemTray.Opacity = _systemTrayOpacity;
                }

                // Bring the application bar if necessary.
                if (_hasApplicationBar)
                {
                    _hasApplicationBar = false;

                    // Application bar can be nulled during the Dismissed event
                    // so a null check needs to be performed here.
                    if (_page.ApplicationBar != null)
                    {
                        _page.ApplicationBar.IsVisible = true;
                    }
                }
            }

            // Dettach event handlers.
            if (_page != null)
            {
                _page.BackKeyPress -= OnBackKeyPress;
                _page.OrientationChanged -= OnOrientationChanged;
                _page = null;
            }

            if (_frame != null)
            {
                _frame.Navigating -= OnNavigating;
                _frame = null;
            }

            // Handle the dismissed event.
            var handlerDismissed = Dismissed;
            if (handlerDismissed != null)
            {
                DismissedEventArgs args = new DismissedEventArgs(source);
                handlerDismissed(this, args);
            }
        }
コード例 #9
0
		private void OnWigCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
		{
			CustomMessageBox cmb = (CustomMessageBox)sender;

			// Unregisters events.
			UnregisterEventHandlers(cmb);

			// Looks the corresponding wherigo message box up in the dictionary, and 
			// gives it a result depending on the custom message box result.
			WF.Player.Core.MessageBox wmb;
			bool hasValue = false;
			lock (_syncRoot)
			{
				hasValue = _wherigoMessageBoxes.TryGetValue(cmb, out wmb);
			}
			if (hasValue)
			{
                // Gives result to the Wherigo message box.
				switch (e.Result)
				{
					case CustomMessageBoxResult.LeftButton:
						wmb.GiveResult(WF.Player.Core.MessageBoxResult.FirstButton);
						break;

					case CustomMessageBoxResult.RightButton:
						wmb.GiveResult(WF.Player.Core.MessageBoxResult.SecondButton);
						break;

					case CustomMessageBoxResult.None:
						// TODO: Keep track of lost message boxes.
						System.Diagnostics.Debug.WriteLine("Dismissed message box with no result: " + wmb.Text);

						wmb.GiveResult(WF.Player.Core.MessageBoxResult.Cancel);
						break;

					default:
						throw new InvalidOperationException("Unknown value of CustomMessageBoxResult cannot be processed: " + e.Result.ToString());
				}

                // Bye bye box.
				bool hasMoreBoxes = false;
                lock (_syncRoot)
                {
                    _wherigoMessageBoxes.Remove(cmb);
					hasMoreBoxes = HasMessageBox;
                }
				
                // If no more message box is managed, send an event.
				if (!hasMoreBoxes)
				{
					BeginRaiseHasMessageBoxChanged(); 
				}
			}

		}
コード例 #10
0
		private void OnCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
		{
			CustomMessageBox cmb = (CustomMessageBox)sender;

			// Unregisters events.
			UnregisterEventHandlers(cmb);

			// Removes this message box if it is registered.
			bool hasValue = false;
			bool hasMoreBoxes = false;
			lock (_syncRoot)
			{
				if (hasValue = _otherMessageBoxes.Contains(cmb))
				{
					_otherMessageBoxes.Remove(cmb);
				}

				hasMoreBoxes = HasMessageBox;
			}

			// Sends an event if it was registered.
			if (hasValue && !hasMoreBoxes)
			{
				// If no more message box is managed, send an event.
				BeginRaiseHasMessageBoxChanged();
			}
		}
コード例 #11
0
        /// <summary>
        /// Dismisses the message box.
        /// </summary>
        /// <param name="source">
        /// The source that caused the dismission.
        /// </param>
        /// <param name="useTransition">
        /// If true, the message box is dismissed after swiveling
        /// backward and out.
        /// </param>
        private void Dismiss(CustomMessageBoxResult source, bool useTransition)
        {
            // Handle the dismissing event.
            var handlerDismissing = Dismissing;
            if (handlerDismissing != null) {
                DismissingEventArgs args = new DismissingEventArgs(source);
                handlerDismissing(this, args);

                if (args.Cancel) {
                    return;
                }
            }

            // Handle the dismissed event.
            var handlerDismissed = Dismissed;
            if (handlerDismissed != null) {
                DismissedEventArgs args = new DismissedEventArgs(source);
                handlerDismissed(this, args);
            }

            // Set the current instance to null.
            _currentInstance = null;

            // Cache this variable to avoid a race condition.
            bool restoreOriginalValues = _mustRestore;

            // Close popup.
            if (useTransition) {
                SwivelTransition backwardOut = new SwivelTransition { Mode = SwivelTransitionMode.BackwardOut };
                ITransition swivelTransition = backwardOut.GetTransition(this);
                swivelTransition.Completed += (s, e) => {
                    swivelTransition.Stop();
                    ClosePopup(restoreOriginalValues);
                };
                swivelTransition.Begin();
            } else {
                ClosePopup(restoreOriginalValues);
            }
        }
コード例 #12
0
 void cmb_Dismissed(object sender, DismissedEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.LeftButton)
     {
         try
         {
             this.DoExportData();
         }
         catch (System.Exception exception)
         {
             this.Alert(exception.Message, null);
         }
     }
 }
コード例 #13
0
        private void OnSavegameCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
        {
            CustomMessageBox cmb = (CustomMessageBox)sender;

            // Unregisters events.
            cmb.Dismissed -= new EventHandler<DismissedEventArgs>(OnSavegameCustomMessageBoxDismissed);

            // Only moves on if OK has been pushed.
            if (e.Result != CustomMessageBoxResult.LeftButton)
            {
                return;
            }

            // Gets the associated savegame.
            Controls.SavegameMessageBoxContentControl content = cmb.Content as Controls.SavegameMessageBoxContentControl;
            if (content == null)
            {
                throw new InvalidOperationException("Message box has no SavegameMessageBoxContentControl.");
            }
            CartridgeSavegame cs = content.Savegame;
            if (cs == null)
            {
                throw new InvalidOperationException("SavegameMessageBoxContentControl has no CartridgeSavegame.");
            }
            
            // If the name already exists, asks if the old savegame should be replaced.
            CartridgeSavegame oldCSWithSameName = GetSavegameByName(content.Name);
            if (oldCSWithSameName != null)
            {
                // Asks for replacing the savegame.
                if (MessageBox.Show(
                        String.Format("A savegame named {0} already exists for this cartridge. Do you want to override it?", content.Name),
                        "Replace savegame?", 
                        MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    // Go: deletes the old savegame and continues.
                    GetCurrentTag().RemoveSavegame(oldCSWithSameName);
                }
                else
                {
                    // No-go: prompt for another name.
                    ShowNewSavegameMessageBox(cs);

                    // Don't go further
                    return;
                }
            }

            // Edits the savegame.
            cs.Name = content.Name;
            cs.HashColor = content.HashColor;

            // Commit.
            cs.ExportToIsoStore();

            // Adds an history entry for this savegame.
            CartridgeTag tag = _appViewModel.Model.CartridgeStore.GetCartridgeTagOrDefault(_appViewModel.Model.Core.Cartridge);
            _appViewModel.Model.History.AddSavedGame(tag, cs);

            // Adds the savegame to the tag.
            tag.AddSavegame(cs);
        }
コード例 #14
0
 private void CustomMessageBoxDismissed(object sender, DismissedEventArgs e)
 {
     try
     {
         if (e.Result.Equals(CustomMessageBoxResult.LeftButton))
         {
             //check if the internet is working, go to Login page. Else display message and load main page
             if (NetworkInterface.GetIsNetworkAvailable())
             {
                 NavigationService.Navigate(new Uri("/FacebookLogin.xaml?" + UriParameter.IsSyncScneario + "=No", UriKind.Relative));
             }
             else
             {
                 MessageBox.Show(AppResources.WarnInternetMsg, AppResources.WarnNwTitle, MessageBoxButton.OK);
                 NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
             }
         }
         else
         {
             NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, AppResources.ErrOnNavigation, MessageBoxButton.OK);
         NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
     }
 }
コード例 #15
0
 void cm_Dismissed(object sender, DismissedEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.LeftButton)
     {
         UpdateVoiceCommandData();
     }
 }