コード例 #1
0
        public static void Load()
        {
            Growl.CoreLibrary.PathUtility.EnsureDirectoryExists(userForwarderDirectory);
            Growl.CoreLibrary.PathUtility.EnsureDirectoryExists(commonForwarderDirectory);

            // built-in displays
            LoadBuiltIn(new BonjourForwardDestinationHandler());   // make sure this is the first item in the list
            LoadBuiltIn(new ManualForwardDestinationHandler());
            LoadBuiltIn(new EmailForwardDestinationHandler());
            LoadBuiltIn(new TwitterForwardDestinationHandler());
            LoadBuiltIn(new ProwlForwardDestinationHandler());
            // -- add additional built-in display styles here
            LoadBuiltIn(new ToastyForwardDestinationHandler());

            // user-specific plugins
            List <PluginInfo> pis = (List <PluginInfo>)ssPluginInfo.Load();

            if (pis != null)
            {
                foreach (PluginInfo pi in pis)
                {
                    LoadPlugin(pi, null);
                }
                pis.Clear();
                pis = null;
            }

            // kick off an async call to discover new forwarder plugins
            System.Threading.ThreadPool.RegisterWaitForSingleObject(Program.ProgramLoadedResetEvent, new System.Threading.WaitOrTimerCallback(DiscoverNewPlugins), null, -1, true);
        }
コード例 #2
0
        public static void Load()
        {
            Growl.CoreLibrary.PathUtility.EnsureDirectoryExists(userDisplayStyleDirectory);
            Growl.CoreLibrary.PathUtility.EnsureDirectoryExists(commonDisplayStyleDirectory);

            // built-in displays
            LoadBuiltIn(new Growl.Displays.Standard.StandardDisplay());
            LoadBuiltIn(new Growl.Displays.Smokestack.SmokestackDisplay());
            LoadBuiltIn(new Growl.Displays.Plain.PlainDisplay());
            LoadBuiltIn(new Growl.Displays.Toast.ToastDisplay());
            LoadBuiltIn(new Growl.Displays.Visor.VisorDisplay());
            // -- add additional built-in display styles here

            // user-specific displays
            // -- read list of known additional displays from .config file or similar
            List <PluginInfo> pis = (List <PluginInfo>)ssPluginInfo.Load();

            if (pis != null)
            {
                foreach (PluginInfo pi in pis)
                {
                    LoadPlugin(pi, null);
                }
                pis.Clear();
                pis = null;
            }

            // kick off an async call to discover new display plugins
            System.Threading.ThreadPool.RegisterWaitForSingleObject(Program.ProgramLoadedResetEvent, new System.Threading.WaitOrTimerCallback(DiscoverNewDisplayPlugins), null, -1, true);
        }
コード例 #3
0
 public static void ReadFromDisk(ref List<InternalNotification> notifications)
 {
     try
     {
         SettingSaver ss = new SettingSaver(FILENAME);
         List<InternalNotification> notificationFromDisk = (List<InternalNotification>)ss.Load();
         if (notifications == null) notifications = new List<InternalNotification>();
         if (notificationFromDisk != null)
         {
             notifications.AddRange(notificationFromDisk);
             notificationFromDisk.Clear();
             notificationFromDisk = null;
         }
         System.IO.File.Delete(ss.Path);
         ss = null;
     }
     catch
     {
     }
 }
コード例 #4
0
        internal void Initialize(string appPath, System.ComponentModel.ISynchronizeInvoke synchronizingObject)
        {
            this.appPath = appPath;
            this.synchronizingObject = synchronizingObject;

            this.historyFolder = Growl.CoreLibrary.PathUtility.Combine(Utility.UserSettingFolder, @"History\");
            PastNotificationManager.HistoryFolder = this.historyFolder;

            string imageCacheFolder = Growl.CoreLibrary.PathUtility.Combine(Utility.UserSettingFolder, @"ImageCache\");
            ImageCache.CacheFolder = imageCacheFolder;

            // handle any upgrade logic
            bool upgrade = (Growl.Properties.Settings.Default.SettingsVersion < 2);
            if (upgrade)
            {
                Utility.WriteDebugInfo("UPGRADE INITIATED");

                SettingSaver raSettingSaver = new SettingSaver(REGISTERED_APPLICATIONS_SETTINGS_FILENAME, LegacyDeserializers.LegacyDeserializationHelper.OldApplicationsHelper);
                raSettingSaver.Save(raSettingSaver.Load());

                SettingSaver fcSettingSaver = new SettingSaver(FORWARD_COMPUTERS_SETTINGS_FILENAME, LegacyDeserializers.LegacyDeserializationHelper.OldForwardDestinationHelper);
                fcSettingSaver.Save(fcSettingSaver.Load());

                SettingSaver sbSettingSaver = new SettingSaver(SUBSCRIPTIONS_SETTINGS_FILENAME, LegacyDeserializers.LegacyDeserializationHelper.OldSubscriptionHelper);
                sbSettingSaver.Save(sbSettingSaver.Load());

                PastNotificationManager.DeleteHistory();

                Growl.Properties.Settings.Default.SettingsVersion = 2;

                Utility.WriteDebugInfo(String.Format("UPGRADE COMPLETED - NOW AT VERSION: {0}", Growl.Properties.Settings.Default.SettingsVersion));
            }

            DisplayStyleManager.DisplayLoaded += new DisplayStyleManager.DisplayLoadedEventHandler(DisplayStyleManager_DisplayLoaded);

            LoadPasswords();
            LoadMiscPrefs();
            LoadDisplays();     // this could take a long time as well, but other things depend on it so we have to do it synchronously and just wait
            LoadApplications();
            LoadForwardedComputers();
            LoadSubscriptions();

            // this must come *after* LoadForwardedComputers has ran
            StartBonjour();

            this.activityMonitor = new ActivityMonitor();
            this.activityMonitor.WentIdle += new ActivityMonitor.ActivityMonitorEventHandler(activityMonitor_WentIdle);
            this.activityMonitor.ResumedActivity += new ActivityMonitor.ActivityMonitorEventHandler(activityMonitor_ResumedActivity);
            this.activityMonitor.StillActive += new EventHandler(activityMonitor_StillActive);
            this.activityMonitor.CheckForIdle = Properties.Settings.Default.CheckForIdle;
            this.activityMonitor.IdleAfterSeconds = Properties.Settings.Default.IdleAfterSeconds;
        }
コード例 #5
0
        public static void ReadFromDisk(ref List <InternalNotification> notifications)

        {
            try

            {
                SettingSaver ss = new SettingSaver(FILENAME);

                List <InternalNotification> notificationFromDisk = (List <InternalNotification>)ss.Load();

                if (notifications == null)
                {
                    notifications = new List <InternalNotification>();
                }

                if (notificationFromDisk != null)

                {
                    notifications.AddRange(notificationFromDisk);

                    notificationFromDisk.Clear();

                    notificationFromDisk = null;
                }

                System.IO.File.Delete(ss.Path);

                ss = null;
            }

            catch

            {
            }
        }