Beispiel #1
0
        public void ToastApplyStyle()
        {
            tlog.Debug(tag, $"ToastApplyStyle START");

            var testingTarget = new Toast();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Toast>(testingTarget, "Should return Toast instance.");

            ToastStyle style = new ToastStyle()
            {
                Text = new TextLabelStyle()
                {
                    Size = new Size(80, 30)
                }
            };

            try
            {
                testingTarget.ApplyStyle(style);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"ToastApplyStyle END (OK)");
        }
        public Toast Builder()
        {
            if (lastToast != null)
            {
                lastToast.Cancel();
                lastToast.Dispose();
                lastToast = null;
            }

            Toast nowToast;

            if (_isNative)
            {
                if (_nativeToast == null)
                {
                    _nativeToast = Toast.MakeText(_mContext, "", ToastLength.Short);
                }
                nowToast = _nativeToast;
            }
            else
            {
                nowToast = new Toast(_mContext);
            }
            SetViewAndText(nowToast);
            SetToastConfig(nowToast);
            SetToastDuring(nowToast);
            if (!_isNative)
            {
                lastToast = nowToast;
            }
            return(nowToast);
        }
Beispiel #3
0
 //Dispose the previous toast if there is one.
 private static void ClearToast()
 {
     if (toast != null)
     {
         toast.Cancel();
         toast.Dispose();
         toast = null;
     }
 }
Beispiel #4
0
 /// <summary>shortcut back to the main screen</summary>
 void ShowUnsupported()
 {
     if (unsupportedToast != null)
     {
         unsupportedToast.Cancel();
         unsupportedToast.Dispose();
     }
     unsupportedToast = Toast.MakeText(this, "Your device does not support this feature", ToastLength.Long);
     unsupportedToast.Show();
 }
Beispiel #5
0
        public static void SendMsg(string msg)
        {
            if (toast != null && msg != msgL)
            {
                toast.Cancel();
                toast.Dispose();
            }

            toast = Toast.MakeText(Android.App.Application.Context, msg, ToastLength.Short);
            toast.Show();
        }
Beispiel #6
0
 public void Toast(string text, bool longDuration = false)
 {
     if (_toast != null)
     {
         _toast.Cancel();
         _toast.Dispose();
         _toast = null;
     }
     _toast = Android.Widget.Toast.MakeText(CrossCurrentActivity.Current.Activity, text,
                                            longDuration ? ToastLength.Long : ToastLength.Short);
     _toast.Show();
 }
Beispiel #7
0
 public void Dispose()
 {
     Chat.Dispose();
     Toast.Dispose();
     PartyFinder.Dispose();
     this.setGlobalBgmHook.Dispose();
     this.handleItemHoverHook.Dispose();
     this.handleItemOutHook.Dispose();
     this.toggleUiHideHook.Dispose();
     this.handleActionHoverHook.Dispose();
     this.handleActionOutHook.Dispose();
 }
Beispiel #8
0
        /// <summary>
        /// Tasks to perform when the application exits.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_Exit(object sender, ExitEventArgs e)
        {
            // Save the users current profile on exit if the setting is set to do so, but also if the override
            // to skip it hasn't been flagged.
            if (Settings.ProfileSettings.SaveSettingsOnExit && SkipSaveOnExit == false)
            {
                App.Settings.SaveSettings();
            }

            // Dispose of the Toast object which has a NotifyIcon which might potentially leave the
            // program in memory if not axed.
            Toast?.Dispose();
        }
Beispiel #9
0
        public void ToastConstructor()
        {
            tlog.Debug(tag, $"ToastConstructor START");

            ToastStyle style = new ToastStyle()
            {
                BackgroundColor = Color.Cyan,
            };

            var testingTarget = new Toast(style);

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Toast>(testingTarget, "Should return Toast instance.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ToastConstructor END (OK)");
        }
Beispiel #10
0
 public void Toast(string text, bool longDuration = false)
 {
     if (!_toast?.Dismissed ?? false)
     {
         _toast.Dismiss(false);
     }
     _toast = new Toast(text)
     {
         Duration = TimeSpan.FromSeconds(longDuration ? 5 : 3)
     };
     _toast.BottomMargin = 110;
     _toast.LeftMargin   = 20;
     _toast.RightMargin  = 20;
     _toast.Show();
     _toast.DismissCallback = () =>
     {
         _toast?.Dispose();
         _toast = null;
     };
 }
Beispiel #11
0
        public void Deactivate()
        {
            if (root != null)
            {
                NUIApplication.GetDefaultWindow().Remove(root);

                if (toast1_1 != null)
                {
                    NUIApplication.GetDefaultWindow().Remove(toast1_1);
                    toast1_1.Dispose();
                    toast1_1 = null;
                }

                if (toast2_1 != null)
                {
                    NUIApplication.GetDefaultWindow().Remove(toast2_1);
                    toast2_1.Dispose();
                    toast2_1 = null;
                }

                int i = 0;
                for (; i < 2; i++)
                {
                    button[i].Dispose();
                    button[i] = null;
                }

                for (i = 0; i < 3; i++)
                {
                    text[i].Dispose();
                    text[i] = null;
                    parentView[i].Dispose();
                    parentView[i] = null;
                }
                root.Dispose();
                root = null;
            }
        }