| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.ComponentModel; |
| 4 |
using System.Data; |
| 5 |
using System.Drawing; |
| 6 |
using System.Text; |
| 7 |
using System.Windows.Forms; |
| 8 |
using System.Diagnostics; |
| 9 |
using WeifenLuo.WinFormsUI.Docking; |
| 10 |
using Somali.EnvControl; |
| 11 |
using Somali.Base; |
| 12 |
|
| 13 |
namespace Somali |
| 14 |
{ |
| 15 |
public partial class SomaliForm : SomaliBaseForm, IWindowPreservable, IActionColleague |
| 16 |
{ |
| 17 |
private IActionMediator _mediator; |
| 18 |
public void SetMediator( IActionMediator mediator ) |
| 19 |
{ |
| 20 |
this._mediator = mediator; |
| 21 |
} |
| 22 |
|
| 23 |
#region プロパティ |
| 24 |
private Size _normalizeSize; |
| 25 |
/// <summary> |
| 26 |
/// 標準サイズ |
| 27 |
/// </summary> |
| 28 |
public Size NormalizeSize |
| 29 |
{ |
| 30 |
set { this._normalizeSize = value; } |
| 31 |
get { return this._normalizeSize; } |
| 32 |
} |
| 33 |
|
| 34 |
private Point _normalizeLocation; |
| 35 |
/// <summary> |
| 36 |
/// 標準ロケーション |
| 37 |
/// </summary> |
| 38 |
public Point NormalizeLocation |
| 39 |
{ |
| 40 |
set { this._normalizeLocation = value; } |
| 41 |
get { return this._normalizeLocation; } |
| 42 |
} |
| 43 |
|
| 44 |
/// <summary> |
| 45 |
/// DockPanelコンポーネント |
| 46 |
/// </summary> |
| 47 |
public DockPanel MainDockPanel |
| 48 |
{ |
| 49 |
get { return this.dockPanelMain; } |
| 50 |
} |
| 51 |
|
| 52 |
public DockState DefaultDockState |
| 53 |
{ |
| 54 |
get { return DockState.Unknown; } |
| 55 |
} |
| 56 |
#endregion |
| 57 |
|
| 58 |
public SomaliForm() |
| 59 |
{ |
| 60 |
InitializeComponent(); |
| 61 |
//this.SetStyle( ControlStyles.CacheText, true ); |
| 62 |
//this.SetStyle( ControlStyles.OptimizedDoubleBuffer, true ); |
| 63 |
//this.SetStyle( ControlStyles.AllPaintingInWmPaint, true ); |
| 64 |
} |
| 65 |
|
| 66 |
/// <summary> |
| 67 |
/// DockPanelの存在検査 |
| 68 |
/// </summary> |
| 69 |
/// <param name="dockPanel"></param> |
| 70 |
/// <returns>true:存在する<br/>false:存在しない</returns> |
| 71 |
public bool IsContainDockPanel( DockPanel dockPanel ) |
| 72 |
{ |
| 73 |
return this.Controls.Contains( dockPanel ); |
| 74 |
} |
| 75 |
|
| 76 |
public void Reflesh() { } |
| 77 |
public void Bind( Model model ) { } |
| 78 |
public void Initialize() { } |
| 79 |
|
| 80 |
#region formEvent |
| 81 |
private void SomaliForm_FormClosing( object sender, FormClosingEventArgs e ) |
| 82 |
{ |
| 83 |
this._mediator.DispatchAction( new SomaliActionArgs( SomaliAction.Exit ) ); |
| 84 |
} |
| 85 |
|
| 86 |
private void SomaliForm_WindowStateChanging( object sender, WindowStateChangingEventArgs e ) |
| 87 |
{ |
| 88 |
if ( this.WindowState == FormWindowState.Normal && e.WindowState != FormWindowState.Normal ) |
| 89 |
{ |
| 90 |
this.NormalizeSize = this.Size; |
| 91 |
this.NormalizeLocation = this.Location; |
| 92 |
} |
| 93 |
} |
| 94 |
#endregion |
| 95 |
|
| 96 |
#region file |
| 97 |
private void openDirMenuItem_Click( object sender, EventArgs e ) |
| 98 |
{ |
| 99 |
FolderBrowserDialog fbd = new FolderBrowserDialog(); |
| 100 |
fbd.Description = "ディレクトリを選択して下さい。"; |
| 101 |
fbd.RootFolder = Environment.SpecialFolder.Desktop; |
| 102 |
fbd.ShowNewFolderButton = false; |
| 103 |
if ( fbd.ShowDialog() == DialogResult.OK ) |
| 104 |
{ |
| 105 |
this._mediator.DispatchAction( new SomaliActionArgs( SomaliAction.OpenDir, fbd.SelectedPath ) ); |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
private void exitMenuItem_Click( object sender, EventArgs e ) |
| 110 |
{ |
| 111 |
//Application.Exit(); |
| 112 |
this.Close(); |
| 113 |
} |
| 114 |
#endregion |
| 115 |
|
| 116 |
#region view |
| 117 |
private void explorerMenuItem_Click( object sender, EventArgs e ) |
| 118 |
{ |
| 119 |
this._mediator.DispatchAction( new SomaliActionArgs( SomaliAction.ShowExplorer ) ); |
| 120 |
} |
| 121 |
|
| 122 |
#endregion |
| 123 |
|
| 124 |
#region analyze |
| 125 |
private void outlineMenuItem_Click( object sender, EventArgs e ) |
| 126 |
{ |
| 127 |
this._mediator.DispatchAction( new SomaliActionArgs( SomaliAction.ShowOutlineAnalizer ) ); |
| 128 |
} |
| 129 |
#endregion |
| 130 |
|
| 131 |
#region tools |
| 132 |
private void preferencesMenuItem_Click( object sender, EventArgs e ) |
| 133 |
{ |
| 134 |
PreferencesForm frmPreferences = new PreferencesForm(); |
| 135 |
frmPreferences.ShowDialog(); |
| 136 |
} |
| 137 |
#endregion |
| 138 |
|
| 139 |
#region help |
| 140 |
private void aboutMenuItem_Click( object sender, EventArgs e ) |
| 141 |
{ |
| 142 |
AboutBox frmAbout = new AboutBox(); |
| 143 |
frmAbout.ShowDialog(); |
| 144 |
} |
| 145 |
#endregion |
| 146 |
|
| 147 |
} |
| 148 |
} |