示例#1
0
        public static AlertButton GenericAlert(string icon, string primaryText, string secondaryText, int defaultButton, params AlertButton[] buttons)
        {
            GenericMessage message = new GenericMessage()
            {
                Icon          = icon,
                Text          = primaryText,
                SecondaryText = secondaryText,
                DefaultButton = defaultButton
            };

            foreach (AlertButton but in buttons)
            {
                message.Buttons.Add(but);
            }

            return(messageService.GenericAlert(message));
        }
示例#2
0
        public static AlertButton GenericAlert(Window parent, string icon, string primaryText, string secondaryText, int defaultButton,
                                               CancellationToken cancellationToken,
                                               params AlertButton[] buttons)
        {
            var message = new GenericMessage(primaryText, secondaryText, cancellationToken)
            {
                Icon          = icon,
                DefaultButton = defaultButton,
            };

            foreach (AlertButton but in buttons)
            {
                message.Buttons.Add(but);
            }

            return(messageService.GenericAlert(parent, message));
        }
示例#3
0
        public static async Task <T> ExecuteTaskAndShowWaitDialog <T> (Task <T> task, string waitMessage, CancellationTokenSource cts)
        {
            bool taskFinished = false;
            var  dontExitMethodUntilDialogClosed = new TaskCompletionSource <bool> ();
            var  delayTask    = Task.Delay(1000);         //Don't show wait dialog immediately, wait 1 sec before showing
            var  finishedTask = await Task.WhenAny(delayTask, task).ConfigureAwait(false);

            if (finishedTask == task)            //If task finished before delayTask, great return value and never display dialog
            {
                return(task.Result);
            }
            //cancelDialog is used to close dialog when task is finished
            var cancelDialog = new CancellationTokenSource();

            Gtk.Application.Invoke((o, args) => {
                if (cancelDialog.Token.IsCancellationRequested)
                {
                    return;
                }
                var gm = new GenericMessage(waitMessage, null, cancelDialog.Token);
                gm.Buttons.Add(AlertButton.Cancel);
                gm.DefaultButton = 0;
                GenericAlert(gm);
                dontExitMethodUntilDialogClosed.SetResult(true);
                if (!taskFinished)
                {
                    //Don't cancel if task finished already, we closed dialog via cancelDialog.Cancel ();
                    //caller of this method might reuse this cts for other tasks
                    cts.Cancel();
                }
            });
            try {
                await task.ConfigureAwait(false);
            } finally {
                taskFinished = true;
                cancelDialog.Cancel();
            }
            await dontExitMethodUntilDialogClosed.Task.ConfigureAwait(false);

            return(task.Result);
        }
		public static AlertButton GenericAlert (GenericMessage message)
		{
			return messageService.GenericAlert (message);
		}
		public static AlertButton GenericAlert (string icon, string primaryText, string secondaryText, int defaultButton,
			CancellationToken cancellationToken,
			params AlertButton[] buttons)
		{
			var message = new GenericMessage (primaryText, secondaryText, cancellationToken) {
				Icon = icon,
				DefaultButton = defaultButton,
			};
			foreach (AlertButton but in buttons)
				message.Buttons.Add (but);
			
			return messageService.GenericAlert (message);
		}
示例#6
0
		public static AlertButton GenericAlert (string icon, string primaryText, string secondaryText, int defaultButton, params AlertButton[] buttons)
		{
			GenericMessage message = new GenericMessage () {
				Icon = icon,
				Text = primaryText,
				SecondaryText = secondaryText,
				DefaultButton = defaultButton
			};
			foreach (AlertButton but in buttons)
				message.Buttons.Add (but);
			
			return messageService.GenericAlert (message);
		}
示例#7
0
		void RunDialog (string message)
		{
			if (disposed)
				return;
			
			string title;
			
			if (message == null) {
				title = GettextCatalog.GetString ("Waiting for debugger");
			} else {
				message = message.Trim ();
				int i = message.IndexOfAny (new char[] { '\n', '\r' });
				if (i > 0) {
					title = message.Substring (0, i).Trim ();
					message = message.Substring (i).Trim ();
				} else {
					title = message;
					message = null;
				}
			}

			var gm = new GenericMessage (title, message, cts.Token);
			gm.Buttons.Add (AlertButton.Cancel);
			gm.DefaultButton = 0;
			MessageService.GenericAlert (gm);
			cts = null;
			
			if (!disposed && UserCancelled != null) {
				UserCancelled (null, null);
			}
		}
示例#8
0
 public static AlertButton GenericAlert(Window parent, GenericMessage message)
 {
     return(messageService.GenericAlert(parent, message));
 }
示例#9
0
 public static AlertButton GenericAlert(GenericMessage message)
 {
     return(GenericAlert((Window)null, message));
 }
示例#10
0
		public static AlertButton GenericAlert (Window parent, GenericMessage message)
		{
			return messageService.GenericAlert (parent, message);
		}
示例#11
0
		public static AlertButton GenericAlert (GenericMessage message)
		{
			return GenericAlert ((Window)null, message);
		}
示例#12
0
 public static AlertButton GenericAlert(GenericMessage message)
 {
     return(messageService.GenericAlert(message));
 }
		void TellUserToStartApplication ()
		{
			var message = new GenericMessage () {
				Text = GettextCatalog.GetString ("Please Start Application"),
				SecondaryText = GettextCatalog.GetString (
					"The application has been built and uploaded, or is already up to date.\n" +
					"Please start it by tapping the application icon on the device."),
				Icon = "phone-apple-iphone",
				DefaultButton = 0,
			};
			
			message.AddOption (DoNotShowAgainKey, GettextCatalog.GetString ("Do not show this message again"),
			                   !IPhoneSettings.ShowStartOnDeviceMessage);
			message.Buttons.Add (AlertButton.Ok);
			MessageService.GenericAlert (message);
			IPhoneSettings.ShowStartOnDeviceMessage = !message.GetOptionValue (DoNotShowAgainKey);
		}