Esempio n. 1
0
        public CMain(string[] args)
        {
            m_Preferences = new Config(Application.StartupPath, "configInterface.xml", "0.01", "lphantInterface");
            m_Preferences.LoadProperties();

            if (args.Length>0)
                m_elink=args[0];

            //bool noInstanceRuning;
            //m_Mutex=new Mutex(true,InterfaceConstants.GUID,out noInstanceRuning);
            m_Mutex=new Mutex(true,InterfaceConstants.GUID);
            //if (noInstanceRuning)
            if (m_Mutex.WaitOne(0,true))
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnAppDomainException);

                if (m_Preferences.GetBool("StartupLocal",true))
                {
                    Application.Run(new eLePhantForm(m_elink,m_Mutex));
                }
                else if (m_Preferences.GetBool("StartupRemote",false))
                {
                    string remoteIP=m_Preferences.GetString("RemoteIP","");
                    int remotePort=m_Preferences.GetInt("RemotePort",0);
                    string remotePass=m_Preferences.GetString("RemotePassword","");
                    if ((remotePort>0)&&(remoteIP.Length>0)&&(remotePass.Length>0))
                    {
                        CedonkeyCRemoto CRemoto=new CedonkeyCRemoto();
                        if (CRemoto.Connect(remoteIP,remotePass,remotePort))
                        {
                            Application.Run(new eLePhantForm(m_elink,m_Mutex,CRemoto.interfazremota));
                        }
                        else
                        {
                            MessageBox.Show("Can not connect with the host specified in preferences","lphant",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                            Application.Run(new StartForm(m_elink,m_Mutex));
                        }
                    }
                    else
                        Application.Run(new StartForm(m_elink,m_Mutex));
                }
                else
                    Application.Run(new StartForm(m_elink,m_Mutex));
            }
            else
            {
                NotifyToMainInstance();
            }
        }
Esempio n. 2
0
        private void Initialize()
        {
            m_PreviousState=FormWindowState.Normal;
            SystemIconsList=new CSystemIconsList();
            Skin=new CSkin();
            m_LastIcon=10;

            preferences = new Config(Application.StartupPath, "configInterface.xml", "0.01", "lphantInterface");
            preferences.PropertyChanged += new Config.PropertyEventHandler(m_OnPropertyChanged);
            preferences.PropertyDefaults += new Config.PropertyDefaultHandler(OnGetDefaultProperty);
            preferences.LoadProperties();

            Globalization=new Classes.Globalization(Application.StartupPath+Path.DirectorySeparatorChar+"language", "interface_", "xml",preferences.GetString("Language"));
            m_Globalize();

            m_KernelLoaded=false;

            toolTipMain.SetToolTip(eLePhantButtonConnect,Globalization["LBL_CONNDISC"]);
            toolTipMain.SetToolTip(buttonOptions,Globalization["LBL_OPTIONS"]);

            taskbarNotifier1=new TaskbarNotifier();
            taskbarNotifier1.SetBackgroundBitmap(new Bitmap(GetType(),"Client.Resources.Classic.PopUpSkin.bmp"),Color.FromArgb(255,0,0));
            taskbarNotifier1.SetCloseBitmap(new Bitmap(typeof(eLePhantForm),"Client.Resources.Classic.close.bmp"),Color.FromArgb(255,0,255),new Point(127,8));
            taskbarNotifier1.TitleRectangle=new Rectangle(50,65,100,70);
            taskbarNotifier1.ContentRectangle=new Rectangle(8,75,133,100);
            taskbarNotifier1.NormalContentColor = Color.White;
            //taskbarNotifier1.TitleClick+=new EventHandler(TitleClick);
            taskbarNotifier1.ContentClick+=new EventHandler(m_BallonClicked);
            //taskbarNotifier1.CloseClick+=new EventHandler(CloseClick);

            Skin.CurrentSkin=preferences.GetString("Skin","default");
            m_ApplySkin();

            graphics.AutoGraphicScale=preferences.GetBool("AutoGraphicScale",false);
            graphics.GraphicScale=preferences.GetInt("GraphicScale",1);

            FDownloads=new FormDownloads();
            FDownloads.TopLevel=false;
            panelContent.Controls.Add(FDownloads);
            FDownloads.Dock = DockStyle.Fill;
            FDownloads.ApplySkin();

            FUploads=new FormUploads();
            FUploads.TopLevel=false;
            FUploads.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FUploads);
            FUploads.Dock = DockStyle.Fill;
            FUploads.ApplySkin();

            FServers=new FormServers();
            FServers.TopLevel=false;
            FServers.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FServers);
            FServers.Dock = DockStyle.Fill;
            FServers.labelmsg=this.labelStatusMsg;
            FServers.ApplySkin();

            FSearchs=new FormSearch();
            FSearchs.TopLevel=false;
            FSearchs.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FSearchs);
            FSearchs.Dock = DockStyle.Fill;
            FSearchs.ApplySkin();

            FFriends=new FormFriends();
            FFriends.TopLevel=false;
            FFriends.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FFriends);
            FFriends.Dock = DockStyle.Fill;
            FFriends.ApplySkin();
        }