Beispiel #1
0
 /// <summary>
 /// Stops this instance of Krento and dispose Krento context.
 /// </summary>
 internal void Stop()
 {
     TraceDebug.Trace("Stop Krento");
     if (context != null)
     {
         try
         {
             if (splashScreen != null)
             {
                 splashScreen.Dispose();
                 splashScreen = null;
             }
             context.StopServer();
             context.UnloadKrentoPlugins();
             context.UnloadKrentoToys();
             context.UnloadKrentoDocklets();
             context.UnloadRingImage();
             context.Dispose();
             context = null;
         }
         catch (Exception ex)
         {
             TraceDebug.Trace("Exception in Startup.Stop: " + ex.Message);
             context = null;
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Stops this instance of Krento and dispose Krento context.
 /// </summary>
 internal void Stop()
 {
     TraceDebug.Trace("Stop Krento");
     if (context != null)
     {
         try
         {
             context.StopServer();
             context.UnloadKrentoPlugins();
             context.UnloadKrentoToys();
             context.UnloadKrentoDocklets();
             context.UnloadRingImage();
             context.Dispose();
             context = null;
         }
         catch (Exception ex)
         {
             TraceDebug.Trace("Exception in Startup.Stop: " + ex.Message);
             context = null;
         }
     }
     CentralPoint.Shutdown();
 }
Beispiel #3
0
        public MainForm(KrentoContext context)
            : base()
        {
            this.context     = context;
            dropFileHandlers = new Dictionary <string, PulsarDropFileHandler>();
            const string doc = ".doc;.xls;.ppt;.docx;.docm;.xlsx;.xlsm;.pptx;.pptm;.vso;.vsd;.mpp;.pub;.xsn;.txt;.rtf;.pdf;.html;.htm;.chm";

            string[] ext = doc.Split(';');
            for (int i = 0; i < ext.Length; i++)
            {
                if (!string.IsNullOrEmpty(ext[i]))
                {
                    dropFileHandlers.Add(ext[i], new PulsarDropFileHandler(MyDocumentsHandler));
                }
            }
            const string pic = ".jpg;.jpeg;.jpe;.gif;.tiff;.tif;.png;.bmp;.rle;.dib;.wmf;.wmz;.emf;.emz;.cgm;.pict;.pic";

            ext = pic.Split(';');
            for (int i = 0; i < ext.Length; i++)
            {
                if (!string.IsNullOrEmpty(ext[i]))
                {
                    dropFileHandlers.Add(ext[i], new PulsarDropFileHandler(MyPicturesHandler));
                }
            }
            const string music = ".wma;.mp3;.acc;.aiff;.wav;.ra;.mid";

            ext = music.Split(';');
            for (int i = 0; i < ext.Length; i++)
            {
                if (!string.IsNullOrEmpty(ext[i]))
                {
                    dropFileHandlers.Add(ext[i], new PulsarDropFileHandler(MyMusicHandler));
                }
            }
            InitializeComponent();
        }
Beispiel #4
0
        internal void Start()
        {
            string ApplicationPrefix = GlobalConfig.ProductName.ToUpperInvariant();

            TraceDebug.Trace("Start {0}", GlobalConfig.ProductName);
#if PORTABLE
            Environment.SetEnvironmentVariable(ApplicationPrefix + "_PORTABLE", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable(ApplicationPrefix + "_DRIVE", GlobalConfig.ApplicationDrive, EnvironmentVariableTarget.Process);
#endif

            Environment.SetEnvironmentVariable(ApplicationPrefix + "_DATA", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process);

            messageID = NativeMethods.RegisterWindowMessage("KrentoStop"); //Do not localize!!!
            NativeMethods.AddRemoveMessageFilter(messageID, ChangeWindowMessageFilterFlags.Add);


            PrepareStandardProperties();

            showSplashScreen = true;

            ApplyGUILanguage();

            GlobalSettings.LoadGlobalSettings();
            GlobalSettings.ManagerLeft = Settings.Default.ManagerLeft;
            GlobalSettings.ManagerTop  = Settings.Default.ManagerTop;



            #region Parse command line
            foreach (string param in args)
            {
                if (TextHelper.SameText(param, @"/low"))
                {
                    GlobalConfig.LowMemory = true;
                }

                if (TextHelper.SameText(param, @"/ns"))
                {
                    showSplashScreen = false;
                }

                if (TextHelper.SameText(param, @"/nd"))
                {
                    KrentoContext.SkipDocklets = true;
                }

                if (TextHelper.SameText(param, @"/nt"))
                {
                    KrentoContext.SkipToys = true;
                }

                if (TextHelper.SameText(param, @"/desktop"))
                {
                    KrentoContext.CreateDesktopCircle = true;
                }

                if (param.IndexOf(@".circle", StringComparison.OrdinalIgnoreCase) > 0)
                {
                    KrentoContext.CircleParameter = param;
                }

                if (FileOperations.IsKrentoPackage(param))
                {
                    KrentoContext.PackageParameter = param;
                }
            }
            #endregion

            this.context = new KrentoContext();

            #region FirstRun
            if (NativeMethods.GlobalCheckAtom("krento_first_run"))
            {
                KrentoContext.FirstRun = true;
                NativeMethods.GlobalKillAtom("krento_first_run");
            }
#if PORTABLE
            string firstRunFile = Path.Combine(GlobalConfig.ApplicationFolder, "first.run");
            if (NativeMethods.FileExists(firstRunFile))
            {
                KrentoContext.FirstRun = true;
                NativeMethods.FileDelete(firstRunFile);
            }
#endif
            if (KrentoContext.FirstRun)
            {
                GlobalSettings.SaveGlobalSettings();
            }
            #endregion

            #region First Instance
            if (context.FirstInstance)
            {
                if ((showSplashScreen) && GlobalSettings.ShowSplashScreen)
                {
                    splashScreen = new SplashScreen();
                }
                else
                {
                    splashScreen = null;
                }



                this.mainForm            = new MainForm(context);
                mainForm.Text            = GlobalConfig.ProductName;
                InteropHelper.MainWindow = mainForm.Handle;

                if (showSplashScreen)
                {
                    if (splashScreen != null)
                    {
                        mainForm.SplashScreen = splashScreen;
                    }
                }


                if (NativeMethods.StartEngineEx(mainForm.Handle))
                {
                    if (GlobalSettings.ActivateServer)
                    {
                        if (NetworkOperations.PortAvailable(GlobalSettings.PortNumber))
                        {
                            context.StartServer();
                        }
                    }


                    appContext = new ApplicationContext();

                    //Load plugins. If the instance is the first instance and
                    //engine is activated, then plugins are loaded

                    try
                    {
                        context.LoadKrentoPlugins();
                    }
                    catch (Exception)
                    {
                        //do not stop on wrong plugins
                        TraceDebug.Trace("Exception on loading Krento plugin");
                    }

                    try
                    {
                        context.LoadKrentoToys();
                    }
                    catch (Exception)
                    {
                        //do not stop on wrong plugins
                        TraceDebug.Trace("Exception on loading Krento toy");
                    }
                    try
                    {
                        context.LoadKrentoDocklets();
                    }
                    catch
                    {
                        //do not stop on wrong docklet
                        TraceDebug.Trace("Exception on loading docklet");
                    }

                    NativeThemeManager.MakeSound("#110");
                    Application.Run(appContext);
                }
            }
            #endregion
        }
Beispiel #5
0
        private void btnCircle_Click(object sender, EventArgs e)
        {
#if !PORTABLE
            KrentoContext.AssociateRingsWithKrento();
#endif
        }