/// <summary> /// メインメニューをセットアップする /// </summary> private void MainMenuSetup() { this.pictureBox1.Image = global::WP7_2012ULV.Properties.Resources.SettingIcon; this.pictureBox1.Click += ( obj, e )=> { this.contextMenuStrip1.Visible = !this.contextMenuStrip1.Visible; this.contextMenuStrip1.Top = this.DesktopLocation.Y + this.pictureBox1.Top + ( this.pictureBox1.Height * 2 ) + 5; this.contextMenuStrip1.Left = this.DesktopLocation.X + this.pictureBox1.Left + 8; }; this.contextMenuStrip1.VisibleChanged += ( obj, e )=> { this.pictureBox1.BorderStyle = this.contextMenuStrip1.Visible ? BorderStyle.FixedSingle : BorderStyle.None; this.contextMenuStrip1.Items["Wp7BreedingItem"].Enabled = this.wp_ != null ; }; var toolStripItems = new ToolStripItem[] { new ToolStripMenuItem( "配合支援", null, new EventHandler((obj, e)=>{ if( this.wp_ == null ) { MessageBox.Show( "未取得です", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error ); return ; } var form = new Breeding.BreedingForm( this.wp_, this.setting_.DispNameType, this.setting_.HorseSireSetting, this.setting_.HorseDamSetting, this.setting_.BreedingToSireSetting, this.setting_.BreedingToDamSetting ); form.Show(); this.BreedingFormList.Add( form ); }) ){ Name = "Wp7BreedingItem", }, new ToolStripSeparator(), new ToolStripMenuItem( "コピー(&C)", null, new EventHandler((obj, e)=>{ if( this.umaListView_ != null ) { var csv = this.umaListView_.ToCSV(); Clipboard.SetText( csv ); MessageBox.Show( "クリップボードにコピーしました", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information ); csv = ""; this.GC_Collect(); } }) ), new ToolStripMenuItem( "ファイルに保存する(&S)", null, new EventHandler((obj, e)=>{ if( this.umaListView_ == null ) { return ; } this.saveFileDialog1.Filter = "テキストファイル (*.txt)|*.txt|全てのファイル (*.*)|*.*"; this.saveFileDialog1.FileName = this.Text + ".txt"; if( this.saveFileDialog1.ShowDialog() == DialogResult.OK ) { var csv = this.umaListView_.ToCSV(); using( var sw = new System.IO.StreamWriter( this.saveFileDialog1.FileName, false, System.Text.Encoding.Default ) ) { sw.Write( csv ); } this.GC_Collect(); } }) ), new ToolStripSeparator(), new ToolStripMenuItem( "WP7バージョン設定", null, new EventHandler((obj, e)=>{ // pass }) ){ Name = "VersionConfigDropDown", Enabled = false, }, new ToolStripMenuItem( "観覧専用モード", null, new EventHandler((obj, e)=>{ var item = obj as ToolStripMenuItem; item.Checked = !item.Checked; this.setting_.Mode = item.Checked ? KOEI.WP7_2012.ReadWriteMode.ReadOnly : KOEI.WP7_2012.ReadWriteMode.ReadWrite; if( this.umaListView_ != null ) { this.umaListView_.Dispose(); this.umaListView_ = null; this.wp_.Dispose(); this.wp_ = null; } }) ) { Name = "ReadOnlyModeItem", }, new ToolStripMenuItem( "カナ表示", null, new EventHandler((obj, e)=>{ var ctr = ( obj as ToolStripMenuItem ); if( ctr == null ) { return; } ctr.Checked = !ctr.Checked; this.setting_.DispNameType = ctr.Checked ? WP7_2012ULV.Enums.NameType.KANA : WP7_2012ULV.Enums.NameType.ENGLISH; }) ){ Name = "FontChangeOptionItem", }, new ToolStripMenuItem( "常に最前面に表示", null, new EventHandler((obj, e)=>{ var ctr = ( obj as ToolStripMenuItem ); if( ctr == null ) { return; } ctr.Checked = !ctr.Checked; this.TopMost = ctr.Checked; }) ){ Checked = false, }, new ToolStripMenuItem( "フォント設定(&O)", null, new EventHandler((obj, e)=>{ if( this.setting_.HorseRaceSetting.Font != null ) { this.fontDialog1.Font = new Font( this.setting_.HorseRaceSetting.Font.Name, this.setting_.HorseRaceSetting.Font.Size, this.setting_.HorseRaceSetting.Font.Style ); } if( this.fontDialog1.ShowDialog() == DialogResult.OK ) { var ary = new [] { this.setting_.HorseChildSetting, this.setting_.HorseDamSetting, this.setting_.HorseRaceSetting, this.setting_.HorseSireSetting, this.setting_.BreedingToSireSetting, this.setting_.BreedingToDamSetting, }; foreach( var setting in ary ) { setting.Font = new UMAListView.ListViewFont() { Name = this.fontDialog1.Font.Name, Size = this.fontDialog1.Font.Size, Style = this.fontDialog1.Font.Style, }; } if( this.umaListView_ != null ) { this.umaListView_.UpdateFontSetting( new UMAListView.ListViewFont() { Name = this.fontDialog1.Font.Name, Size = this.fontDialog1.Font.Size, Style = this.fontDialog1.Font.Style, }); } } }) ), new ToolStripSeparator(), new ToolStripMenuItem( "最新版をチェック", null, new EventHandler((obj, e)=>{ System.Diagnostics.Process.Start( Program.WEBSITE_URL ); }) ), new ToolStripMenuItem( "バージョン情報(&V)", null, new EventHandler((obj, e)=>{ MessageBox.Show( String.Format("{0} - {1}", Program.AssemblyName, Program.AssemblyVersion ), "バージョン情報", MessageBoxButtons.OK, MessageBoxIcon.None ); }) ), new ToolStripMenuItem( "終了(&X)", null, new EventHandler((obj, e)=>{ this.Close(); }) ), }; foreach( var item in toolStripItems ) { this.contextMenuStrip1.Items.Add( item ); } ((ToolStripMenuItem) this.contextMenuStrip1.Items["ReadOnlyModeItem"]).Checked = this.setting_.Mode == ReadWriteMode.ReadOnly; ((ToolStripMenuItem) this.contextMenuStrip1.Items["FontChangeOptionItem"]).Checked = this.setting_.DispNameType == WP7_2012ULV.Enums.NameType.KANA; var versionItems = (ToolStripMenuItem) this.contextMenuStrip1.Items["VersionConfigDropDown"]; if( this.version_setting_ != null ) { foreach( var config in this.version_setting_.VersionConfigList ) { var radioButton = new ToolStripRadioButtonMenuItem( config.AssemblyString, null, (obj, e)=>{ var self = obj as ToolStripMenuItem; if( self == null || !self.Checked ) { return; } this.setting_.VersionConfigAssembly = (WP7_2012ULV.Setting.WPVersionConfig.Assembly)self.Tag; this.UpdateFormTitle(); }){ Name = config.AssemblyString, Tag = new WP7_2012ULV.Setting.WPVersionConfig.Assembly() { AssemblyName = config.AssemblyName, ClassName = config.ClassName, AssemblyString = config.AssemblyString, }, Checked = this.setting_.VersionConfigAssembly.AssemblyString == config.AssemblyString }; versionItems.Enabled = true; versionItems.DropDownItems.Add( radioButton ); } } }
/// <summary> /// 馬リストをフォームに表示する /// </summary> private void DispHorseList() { if( this.wp_ == null ) { return; } this.UpdateFormTitle(); var sw = new System.Diagnostics.Stopwatch(); sw.Start(); var horse_type = (Enums.HorseType) this.tabControl1.TabPages[ this.tabControl1.SelectedIndex ].Tag; this.umaListView_Config_.DispNameType = this.setting_.DispNameType; if( this.umaListView_ != null && this.currentHorseType_ == horse_type ) { this.umaListView_.CreateHorseList( this.wp_ ); } else { UMAListView.UMAListViewTpl uma_listview; UMAListView.Setting uma_listview_setting; this.UpdateUMAListViewSetting(); switch( horse_type ) { case Enums.HorseType.CHILD: uma_listview = new HorseChildListView( this.umaListView_Config_, this.setting_.Mode, this.extension_setting_.HorseChildExtensions, this.ExtenstionsDir ); uma_listview_setting = this.setting_.HorseChildSetting; break; case Enums.HorseType.RACE: uma_listview = new HorseRaceListView( this.umaListView_Config_, this.setting_.Mode, this.extension_setting_.HorseRaceExtensions, this.ExtenstionsDir ); uma_listview_setting = this.setting_.HorseRaceSetting; break; case Enums.HorseType.DAM: uma_listview = new HorseDamListView( this.umaListView_Config_, this.setting_.Mode, this.extension_setting_.HorseDamExtensions, this.ExtenstionsDir ); uma_listview_setting = this.setting_.HorseDamSetting; break; case Enums.HorseType.SIRE: uma_listview = new HorseSireListView( this.umaListView_Config_, this.setting_.Mode, this.extension_setting_.HorseSireExtensions, this.ExtenstionsDir ); uma_listview_setting = this.setting_.HorseSireSetting; break; default: MessageBox.Show("[BUG]"); return; } if( this.mainPanel.Controls.Count != 0 ) { this.umaListView_.Dispose(); this.mainPanel.Controls.Clear(); this.umaListView_ = null; } this.umaListView_ = uma_listview; this.umaListView_.Dock = DockStyle.Fill; this.umaListView_.FromSetting( uma_listview_setting ); this.umaListView_.CreateHorseList( this.wp_ ); this.mainPanel.Controls.Add( this.umaListView_ ); this.currentHorseType_ = horse_type; } sw.Stop(); this.toolStripStatusLabel2.Text = String.Format( "{0}(ms)", sw.ElapsedMilliseconds ); this.toolStripStatusLabel3.Text = String.Format( "{0}(line)", this.umaListView_.ItemsCount ); this.toolStripStatusLabel4.Text = String.Format( "白毛:{0}(頭)", this.umaListView_.WhiteColorHorseCount ); this.GC_Collect(); }