Ejemplo n.º 1
0
        internal static void Process()
        {
            EmptyArgsVoidDelegate func = null;

            lock (_lock)
            {
                if (_tasks.Count > 0)
                {
                    func = _tasks.Dequeue();
                }
            }

            while (func != null)
            {
                try
                {
                    func.Invoke();
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("UiTask invoke exception at {0}.{1}", func.Method.DeclaringType.FullName, func.Method.Name), ex);
                }

                func = null;

                lock (_lock)
                {
                    if (_tasks.Count > 0)
                    {
                        func = _tasks.Dequeue();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public static void BeginInvoke(EmptyArgsVoidDelegate lambda)
 {
     lock (_lock)
     {
         _tasks.Enqueue(lambda);
     }
 }
Ejemplo n.º 3
0
 public void Register(char character, EmptyArgsVoidDelegate action)
 {
     _accelerators.Add(new Accelerator()
     {
         Modifiers = KeyModifiers.None,
         Key       = Keys.None,
         Action    = action,
         Character = character
     });
 }
Ejemplo n.º 4
0
 public void Register(KeyModifiers modifiers, Keys key, EmptyArgsVoidDelegate action)
 {
     _accelerators.Add(new Accelerator()
     {
         Modifiers = modifiers,
         Key       = key,
         Action    = action,
         Character = '\0'
     });
 }
Ejemplo n.º 5
0
 public void DoActionWhenUnfocused(EmptyArgsVoidDelegate action)
 {
     if (!Focused)
     {
         action();
     }
     else
     {
         UiTask.BeginInvoke(() => DoActionWhenUnfocused(action));
     }
 }
Ejemplo n.º 6
0
        void CloseMessageBox()
        {
            HideElement("MessageBox");

            if (_onMessageBoxClose != null)
            {
                _onMessageBoxClose();
                _onMessageBoxClose = null;
            }

            AppMain.Current.ReleaseFocus(this);
        }
Ejemplo n.º 7
0
        internal static void Process()
        {
            EmptyArgsVoidDelegate func = null;

            lock (_lock)
            {
                if (_tasks.Count > 0)
                {
                    func = _tasks.Dequeue();
                }
            }

            while (func != null)
            {
#if !DEBUG
                try
                {
                    func.Invoke();
                }
                catch (Exception ex)
                {
#if !WINDOWS_PHONE_APP && !WINDOWS_UWP
                    throw new Exception(string.Format("UiTask invoke exception at {0}.{1}", func.Method.DeclaringType.FullName, func.Method.Name), ex);
#else
                    throw ex;
#endif
                }
#else
                func.Invoke();
#endif

                func = null;

                lock (_lock)
                {
                    if (_tasks.Count > 0)
                    {
                        func = _tasks.Dequeue();
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void MessageBoxYesNoCancel(string text, EmptyArgsVoidDelegate onYes, EmptyArgsVoidDelegate onNo = null, EmptyArgsVoidDelegate alwaysCall = null)
        {
            _yesNoVisible  = true;
            _cancelVisible = true;

            _onMessageBoxYes   = onYes;
            _onMessageBoxNo    = onNo;
            _onMessageBoxClose = alwaysCall;

            MessageBoxText.StringValue = text;
            ShowElement("MessageBox");
            ShowElement("MessageBoxNo");
            ShowElement("MessageBoxYes");
            ShowElement("MessageBoxCancel");
            HideElement("MessageBoxOk");

            HideElement("MessageBoxNo2");
            HideElement("MessageBoxYes2");

            AppMain.Current.SetFocus(this);
        }
Ejemplo n.º 9
0
        public static void OpenMail(string name, string address, string subject, string text, EmptyArgsVoidDelegate completed)
        {
            name    = Uri.EscapeDataString(name);
            subject = Uri.EscapeDataString(subject);
            text    = Uri.EscapeDataString(text);
            String command = String.Format("mailto:{0}<{1}>?subject={2}&body={3}", name, address, subject, text);

            Process.Start(command);

            if (completed != null)
            {
                completed.Invoke();
            }
        }
Ejemplo n.º 10
0
 public static void YesNoCancel(string text, EmptyArgsVoidDelegate onYes, EmptyArgsVoidDelegate onNo = null, EmptyArgsVoidDelegate alwaysCall = null)
 {
     MessageBoxController.Current.MessageBoxYesNoCancel(text, onYes, onNo, alwaysCall);
 }
Ejemplo n.º 11
0
 public static void OpenMail(string name, string address, string subject, string text, EmptyArgsVoidDelegate completed)
 {
 }