コード例 #1
0
ファイル: Display.cs プロジェクト: sshyran/growl-for-windows
            public object GetRealObject(StreamingContext context)
            {
                Display display = DisplayStyleManager.FindDisplayStyle(this.displayName);

                if (display == null)
                {
                    display = Display.Default;
                }
                return(display);
            }
コード例 #2
0
        public void HandleSystemNotifications(ref List <InternalNotification> queuedNotifications)
        {
            if (queuedNotifications != null)
            {
                foreach (InternalNotification n in queuedNotifications)
                {
                    Display display = (n.Display != null ? DisplayStyleManager.FindDisplayStyle(n.Display) : null);
                    SendSystemNotification(n.Title, n.Text, display);
                }

                queuedNotifications.Clear();
            }
            queuedNotifications = null;
        }
コード例 #3
0
        internal void AlreadyRunning(int signalFlag, int signalValue)
        {
            ApplicationMain.Signal signal = (ApplicationMain.Signal)signalFlag;
            bool silent            = ((signal & ApplicationMain.Signal.Silent) == ApplicationMain.Signal.Silent);
            bool reloadDisplays    = ((signal & ApplicationMain.Signal.ReloadDisplays) == ApplicationMain.Signal.ReloadDisplays);
            bool updateLanguage    = ((signal & ApplicationMain.Signal.UpdateLanguage) == ApplicationMain.Signal.UpdateLanguage);
            bool handleListenUrl   = ((signal & ApplicationMain.Signal.HandleListenUrl) == ApplicationMain.Signal.HandleListenUrl);
            bool reloadForwarders  = ((signal & ApplicationMain.Signal.ReloadForwarders) == ApplicationMain.Signal.ReloadForwarders);
            bool reloadSubscribers = ((signal & ApplicationMain.Signal.ReloadSubscribers) == ApplicationMain.Signal.ReloadSubscribers);
            bool showSettings      = ((signal & ApplicationMain.Signal.ShowSettings) == ApplicationMain.Signal.ShowSettings);

            if (!silent && this.controller != null)
            {
                this.controller.SendSystemNotification(Properties.Resources.SystemNotification_Running_Title, Properties.Resources.SystemNotification_Running_Text, null);
            }

            if (reloadDisplays)
            {
                DisplayStyleManager.DiscoverNewDisplayPlugins();
                //if(this.mainForm != null) this.mainForm.BindDisplayList();
            }

            if (updateLanguage)
            {
                if (signalValue == 0)
                {
                    Properties.Settings.Default.CultureCode = "";
                }
                else
                {
                    // read each subfolder in the app folder and find the one with the matching hash
                    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Application.StartupPath);
                    foreach (System.IO.DirectoryInfo directory in di.GetDirectories())
                    {
                        if (directory.Name.GetHashCode() == signalValue)
                        {
                            Properties.Settings.Default.CultureCode = directory.Name;
                            break;
                        }
                    }
                }
            }

            if (handleListenUrl)
            {
                HandleListenUrls();
            }

            if (reloadForwarders)
            {
                ForwardDestinationManager.DiscoverNewPlugins();

                /* NOTE: the signalValue should be the hash of the plugin folder that was loaded,
                 * so we could loop through the folders looking for a matching has (similar to how
                 * the updateLanguage section works above), but the DiscoverNewPlugins already
                 * loops through the folders anyway, so we can just let it do its thing. */
            }

            if (reloadSubscribers)
            {
                SubscriptionManager.DiscoverNewPlugins();

                /* NOTE: the signalValue should be the hash of the plugin folder that was loaded,
                 * so we could loop through the folders looking for a matching has (similar to how
                 * the updateLanguage section works above), but the DiscoverNewPlugins already
                 * loops through the folders anyway, so we can just let it do its thing. */
            }

            if (showSettings)
            {
                this.ShowForm();
            }
        }