Esempio n. 1
0
 /// <summary>
 /// Adds a notification to be sent with flags, at a specific time.
 /// </summary>
 /// <param name="time">The time to send the notification.</param>
 /// <param name="payload">The notification.</param>
 /// <param name="flags">The notification flags that determine the notification behaviour. This parameter is set to Retroactive by default.</param>
 /// <seealso cref="UnityEngine.Timeline.NotificationFlags"/>
 public void AddNotification(double time, INotification payload, NotificationFlags flags = NotificationFlags.Retroactive)
 {
     m_Notifications.Add(new NotificationEntry
     {
         time    = time,
         payload = payload,
         flags   = flags
     });
     m_NeedSortNotifications = true;
 }
 private void setFlag(NotificationFlags mask, bool value)
 {
     if (value)
     {
         Notification.Flags |= mask;
     }
     else
     {
         Notification.Flags &= ~mask;
     }
 }
Esempio n. 3
0
        public FormNotification(FormBrowser owner, PluginManager pluginManager, NotificationFlags flags)
        {
            InitializeComponent();

            this.owner   = owner;
            this.plugins = pluginManager;
            this.flags   = flags;

            owner.FormClosed += (sender, args) => Close();

            browser = new ChromiumWebBrowser("about:blank")
            {
                MenuHandler     = new ContextMenuNotification(this, !flags.HasFlag(NotificationFlags.DisableContextMenu)),
                LifeSpanHandler = new LifeSpanHandler()
            };

            #if DEBUG
            browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
            #endif

            browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
            browser.LoadingStateChanged         += Browser_LoadingStateChanged;
            browser.FrameLoadEnd += Browser_FrameLoadEnd;

            if (!flags.HasFlag(NotificationFlags.DisableScripts))
            {
                notificationJS = ScriptLoader.LoadResource(NotificationScriptFile);
                browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(owner, this));

                if (plugins != null)
                {
                    pluginJS = ScriptLoader.LoadResource(PluginManager.PluginNotificationScriptFile);
                    browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
                }
            }

            panelBrowser.Controls.Add(browser);

            if (flags.HasFlag(NotificationFlags.AutoHide))
            {
                Program.UserConfig.MuteToggled += Config_MuteToggled;
                Disposed += (sender, args) => Program.UserConfig.MuteToggled -= Config_MuteToggled;

                if (Program.UserConfig.MuteNotifications)
                {
                    PauseNotification();
                }
            }

            mouseHookDelegate = MouseHookProc;

            Disposed += FormNotification_Disposed;
        }
Esempio n. 4
0
        public FormNotificationScreenshotable(Action callback, FormBrowser owner, NotificationFlags flags) : base(owner, null, flags)
        {
            browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));

            browser.FrameLoadEnd += (sender, args) => {
                if (args.Frame.IsMain && browser.Address != "about:blank")
                {
                    ScriptLoader.ExecuteScript(args.Frame, "window.setTimeout($TD_NotificationScreenshot.trigger, 25)", "gen:screenshot");
                }
            };

            UpdateTitle();
        }
Esempio n. 5
0
        public static NotificationFlags GetFlagsFromInt(int n)
        {
            NotificationFlags flags = NotificationFlags.FLAG_NONE;

            if (IsBitSet(n, 1))
            {
                flags = flags & NotificationFlags.FLAG_SHOW_LIGHTS;
            }
            else if (IsBitSet(n, 2))
            {
                flags = flags & NotificationFlags.FLAG_ONGOING_EVENT;
            }
            else if (IsBitSet(n, 3))
            {
                flags = flags & NotificationFlags.FLAG_INSISTENT;
            }
            else if (IsBitSet(n, 4))
            {
                flags = flags & NotificationFlags.FLAG_ONLY_ALERT_ONCE;
            }
            else if (IsBitSet(n, 5))
            {
                flags = flags & NotificationFlags.FLAG_AUTO_CANCEL;
            }
            else if (IsBitSet(n, 6))
            {
                flags = flags & NotificationFlags.FLAG_NO_CLEAR;
            }
            else if (IsBitSet(n, 7))
            {
                flags = flags & NotificationFlags.FLAG_FOREGROUND_SERVICE;
            }
            else if (IsBitSet(n, 8))
            {
                flags = flags & NotificationFlags.FLAG_HIGH_PRIORITY;
            }
            else if (IsBitSet(n, 9))
            {
                flags = flags & NotificationFlags.FLAG_LOCAL_ONLY;
            }
            else if (IsBitSet(n, 10))
            {
                flags = flags & NotificationFlags.FLAG_GROUP_SUMMARY;
            }
            return(flags);
        }
Esempio n. 6
0
        /// <summary>
        ///     Shows a notification in the team explorer.
        /// </summary>
        /// <param name="message">The message to display.</param>
        /// <param name="notificationType">The notification type.</param>
        /// <param name="teamExplorerPage">
        ///     The team explorer page. If none / [null] is provided, it will be displayed on the
        ///     <see cref="CurrentTeamExplorerPage">currently active page</see>.
        /// </param>
        /// <param name="commandToExecuteOnClick">
        ///     The command to execute on click. Use [null] for no command / action to perform on
        ///     click.
        /// </param>
        /// <param name="notificationId">
        ///     The notification identifier. Optional, if one is provided it can either be used in
        ///     <see cref="IsNotificationVisibleInTeamExplorer" /> or <see cref="HideNotificationInTeamExplorer" />.
        /// </param>
        /// <param name="notificationFlags">The notification flags.</param>
        protected void ShowNotificationInTeamExplorer(string message, NotificationType notificationType = NotificationType.Information, ITeamExplorerPage teamExplorerPage = null, ICommand commandToExecuteOnClick = null, Guid notificationId = default(Guid), NotificationFlags notificationFlags = NotificationFlags.None)
        {
            Debug.Assert(!string.IsNullOrWhiteSpace(message), "No empty notifications, please.");

            TeamExplorerUtils.Instance.ShowNotification(ServiceProvider, message, notificationType, notificationFlags, commandToExecuteOnClick, notificationId == default(Guid) ? Guid.NewGuid() : notificationId, teamExplorerPage);
        }
 void ITeamExplorer.ShowNotification(string message, NotificationType type, NotificationFlags flags, ICommand command, Guid id)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 public Notification(string packageName, int flags)
 {
     PackageName = packageName;
     Flags       = GetFlagsFromInt(flags);
 }
Esempio n. 9
0
 public Notification(string packageName, NotificationFlags flags)
 {
     PackageName = packageName;
     Flags       = flags;
 }
 private void setFlag(NotificationFlags mask, bool value) {
   if (value) {
     Notification.Flags |= mask;
   } else {
     Notification.Flags &= ~mask;
   }
 }
 void ITeamExplorer.ShowNotification(string message, NotificationType type, NotificationFlags flags, ICommand command, Guid id)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public static void Notification(string message, NotificationType notificationType = NotificationType.Information, NotificationFlags flags = NotificationFlags.None, ICommand command = null,
                                 Guid id = default(Guid))
 {
     if (!string.IsNullOrWhiteSpace(message))
     {
         if (id == default(Guid))
         {
             id = Guid.NewGuid();
         }
         var explorer = CheckoutAndBuild2Package.GetGlobalService <ITeamExplorer>();
         explorer.ShowNotification(message, notificationType, flags, command, id);
     }
 }
Esempio n. 13
0
        public static void Notification(string message, NotificationType notificationType, NotificationFlags flags, Action action)

        {
            var      id  = Guid.NewGuid();
            ICommand cmd = null;

            if (action != null)
            {
                cmd = new DelegateCommand <object>(o =>
                {
                    HideNotification(id);
                    action();
                });
            }
            Notification(message, notificationType, flags, cmd, id);
        }
Esempio n. 14
0
        // notification helpers

        public FormNotification CreateNotificationForm(NotificationFlags flags)
        {
            return(new FormNotification(this, plugins, flags));
        }
Esempio n. 15
0
 public Notification(string packageName, int flags)
 {
     PackageName = packageName;
     Flags = GetFlagsFromInt(flags);
 }
Esempio n. 16
0
 public Notification(string packageName, NotificationFlags flags)
 {
     PackageName = packageName;
     Flags = flags;
 }