Esempio n. 1
0
		private async void FormMain_Load( object sender, EventArgs e ) {
			if ( !Directory.Exists( "Settings" ) )
				Directory.CreateDirectory( "Settings" );


			Utility.Configuration.Instance.Load( this );


			Utility.Logger.Instance.LogAdded += new Utility.LogAddedEventHandler( ( Utility.Logger.LogData data ) => {
				if ( InvokeRequired ) {
					// Invokeはメッセージキューにジョブを投げて待つので、別のBeginInvokeされたジョブが既にキューにあると、
					// それを実行してしまい、BeginInvokeされたジョブの順番が保てなくなる
					// GUIスレッドによる処理は、順番が重要なことがあるので、GUIスレッドからInvokeを呼び出してはいけない
					Invoke( new Utility.LogAddedEventHandler( Logger_LogAdded ), data );
				} else {
					Logger_LogAdded( data );
				}
			} );
			Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged;

			Utility.Logger.Add( 2, SoftwareInformation.SoftwareNameEnglish + Resources.IsStarting );


			this.Text = SoftwareInformation.SoftwareNameEnglish + " " + SoftwareInformation.VersionEnglish;

			ResourceManager.Instance.Load();
			RecordManager.Instance.Load();
			KCDatabase.Instance.Load();
			NotifierManager.Instance.Initialize( this );
			SyncBGMPlayer.Instance.ConfigurationChanged();

			#region Icon settings
			Icon = ResourceManager.Instance.AppIcon;

			StripMenu_File_Configuration.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormConfiguration];

			StripMenu_View_Fleet.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet];
			StripMenu_View_FleetOverview.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet];
			StripMenu_View_ShipGroup.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormShipGroup];
			StripMenu_View_Dock.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDock];
			StripMenu_View_Arsenal.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormArsenal];
			StripMenu_View_Headquarters.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormHeadQuarters];
			StripMenu_View_Quest.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormQuest];
			StripMenu_View_Information.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormInformation];
			StripMenu_View_Compass.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormCompass];
			StripMenu_View_Battle.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBattle];
			StripMenu_View_Browser.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBrowser];
			StripMenu_View_Log.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormLog];
			StripMenu_WindowCapture.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormWindowCapture];

			StripMenu_Tool_EquipmentList.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormEquipmentList];
			StripMenu_Tool_DropRecord.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDropRecord];
			StripMenu_Tool_DevelopmentRecord.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDevelopmentRecord];
			StripMenu_Tool_ConstructionRecord.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormConstructionRecord];
			StripMenu_Tool_ResourceChart.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormResourceChart];
			StripMenu_Tool_AlbumMasterShip.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormAlbumShip];
			StripMenu_Tool_AlbumMasterEquipment.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormAlbumEquipment];

			StripMenu_Help_Version.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.AppIcon];
			#endregion


			APIObserver.Instance.Start( Utility.Configuration.Config.Connection.Port, this );


			MainDockPanel.Extender.FloatWindowFactory = new CustomFloatWindowFactory();


			SubForms = new List<DockContent>();

			//form init
			//注:一度全てshowしないとイベントを受け取れないので注意
			fFleet = new FormFleet[4];
			for ( int i = 0; i < fFleet.Length; i++ ) {
				SubForms.Add( fFleet[i] = new FormFleet( this, i + 1 ) );
			}

			SubForms.Add( fDock = new FormDock( this ) );
			SubForms.Add( fArsenal = new FormArsenal( this ) );
			SubForms.Add( fHeadquarters = new FormHeadquarters( this ) );
			SubForms.Add( fInformation = new FormInformation( this ) );
			SubForms.Add( fCompass = new FormCompass( this ) );
			SubForms.Add( fLog = new FormLog( this ) );
			SubForms.Add( fQuest = new FormQuest( this ) );
			SubForms.Add( fBattle = new FormBattle( this ) );
			SubForms.Add( fFleetOverview = new FormFleetOverview( this ) );
			SubForms.Add( fShipGroup = new FormShipGroup( this ) );
			SubForms.Add( fBrowser = new FormBrowserHost( this ) );
			SubForms.Add( fWindowCapture = new FormWindowCapture( this ) );
            SubForms.Add(fXPCalculator = new FormXPCalculator(this));


			ConfigurationChanged();		//設定から初期化

			LoadLayout( Configuration.Config.Life.LayoutFilePath );



			SoftwareInformation.CheckUpdate();

			// デバッグ: 開始時にAPIリストを読み込む
			if ( Configuration.Config.Debug.LoadAPIListOnLoad ) {

				try {

					await Task.Factory.StartNew( () => LoadAPIList( Configuration.Config.Debug.APIListPath ) );

				} catch ( Exception ex ) {

					Utility.Logger.Add( 3, LoggerRes.FailedLoadAPI + ex.Message );
				}
			}


			// 🎃
			if ( DateTime.Now.Month == 10 && DateTime.Now.Day == 31 ) {
				APIObserver.Instance.APIList["api_port/port"].ResponseReceived += CallPumpkinHead;
			}

			// 完了通知(ログインページを開く)
			fBrowser.InitializeApiCompleted();

			UIUpdateTimer.Start();


			Utility.Logger.Add( 3, Resources.StartupComplete );

		}
Esempio n. 2
0
        private async void FormMain_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists("Settings"))
            {
                Directory.CreateDirectory("Settings");
            }


            Utility.Configuration.Instance.Load();
            Utility.Logger.Instance.LogAdded += new Utility.LogAddedEventHandler((Utility.Logger.LogData data) => {
                if (InvokeRequired)
                {
                    // Invokeはメッセージキューにジョブを投げて待つので、別のBeginInvokeされたジョブが既にキューにあると、
                    // それを実行してしまい、BeginInvokeされたジョブの順番が保てなくなる
                    // GUIスレッドによる処理は、順番が重要なことがあるので、GUIスレッドからInvokeを呼び出してはいけない
                    Invoke(new Utility.LogAddedEventHandler(Logger_LogAdded), data);
                }
                else
                {
                    Logger_LogAdded(data);
                }
            });
            Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged;

            Utility.Logger.Add(2, SoftwareInformation.SoftwareNameJapanese + Resources.IsStarting);


            this.Text = SoftwareInformation.VersionJapanese;

            ResourceManager.Instance.Load();
            RecordManager.Instance.Load();
            KCDatabase.Instance.Load();
            NotifierManager.Instance.Initialize(this);
            SyncBGMPlayer.Instance.ConfigurationChanged();

            #region Icon settings
            Icon = ResourceManager.Instance.AppIcon;

            StripMenu_File_Configuration.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormConfiguration];

            StripMenu_View_Fleet.Image         = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet];
            StripMenu_View_FleetOverview.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormFleet];
            StripMenu_View_ShipGroup.Image     = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormShipGroup];
            StripMenu_View_Dock.Image          = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDock];
            StripMenu_View_Arsenal.Image       = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormArsenal];
            StripMenu_View_Headquarters.Image  = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormHeadQuarters];
            StripMenu_View_Quest.Image         = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormQuest];
            StripMenu_View_Information.Image   = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormInformation];
            StripMenu_View_Compass.Image       = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormCompass];
            StripMenu_View_Battle.Image        = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBattle];
            StripMenu_View_Browser.Image       = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBrowser];
            StripMenu_View_Log.Image           = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormLog];
            StripMenu_WindowCapture.Image      = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormWindowCapture];

            StripMenu_Tool_EquipmentList.Image        = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormEquipmentList];
            StripMenu_Tool_DropRecord.Image           = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDropRecord];
            StripMenu_Tool_DevelopmentRecord.Image    = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDevelopmentRecord];
            StripMenu_Tool_ConstructionRecord.Image   = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormConstructionRecord];
            StripMenu_Tool_ResourceChart.Image        = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormResourceChart];
            StripMenu_Tool_AlbumMasterShip.Image      = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormAlbumShip];
            StripMenu_Tool_AlbumMasterEquipment.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormAlbumEquipment];

            StripMenu_Help_Version.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.AppIcon];
            #endregion


            APIObserver.Instance.Start(Utility.Configuration.Config.Connection.Port, this);


            MainDockPanel.Extender.FloatWindowFactory = new CustomFloatWindowFactory();


            SubForms = new List <DockContent>();

            //form init
            //注:一度全てshowしないとイベントを受け取れないので注意
            fFleet = new FormFleet[4];
            for (int i = 0; i < fFleet.Length; i++)
            {
                SubForms.Add(fFleet[i] = new FormFleet(this, i + 1));
            }

            SubForms.Add(fDock          = new FormDock(this));
            SubForms.Add(fArsenal       = new FormArsenal(this));
            SubForms.Add(fHeadquarters  = new FormHeadquarters(this));
            SubForms.Add(fInformation   = new FormInformation(this));
            SubForms.Add(fCompass       = new FormCompass(this));
            SubForms.Add(fLog           = new FormLog(this));
            SubForms.Add(fQuest         = new FormQuest(this));
            SubForms.Add(fBattle        = new FormBattle(this));
            SubForms.Add(fFleetOverview = new FormFleetOverview(this));
            SubForms.Add(fShipGroup     = new FormShipGroup(this));
            SubForms.Add(fBrowser       = new FormBrowserHost(this));
            SubForms.Add(fWindowCapture = new FormWindowCapture(this));
            SubForms.Add(fXPCalculator  = new FormXPCalculator(this));
            SubForms.Add(fDialogue      = new FormDialogue(this));


            ConfigurationChanged();                     //設定から初期化

            LoadLayout(Configuration.Config.Life.LayoutFilePath);



            SoftwareInformation.CheckUpdate();

            // デバッグ: 開始時にAPIリストを読み込む
            if (Configuration.Config.Debug.LoadAPIListOnLoad)
            {
                try {
                    await Task.Factory.StartNew(() => LoadAPIList( Configuration.Config.Debug.APIListPath ));
                } catch (Exception ex) {
                    Utility.Logger.Add(3, LoggerRes.FailedLoadAPI + ex.Message);
                }
            }


            // 🎃
            if (DateTime.Now.Month == 10 && DateTime.Now.Day == 31)
            {
                APIObserver.Instance.APIList["api_port/port"].ResponseReceived += CallPumpkinHead;
            }

            // 完了通知(ログインページを開く)
            fBrowser.InitializeApiCompleted();

            UIUpdateTimer.Start();

            Utility.Logger.Add(2, Resources.StartupComplete);
        }