| 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 Somali.Base; |
| 9 |
using Somali.Models; |
| 10 |
|
| 11 |
namespace Somali |
| 12 |
{ |
| 13 |
public partial class ExplorerForm : WeifenLuo.WinFormsUI.Docking.DockContent, IActionColleague |
| 14 |
{ |
| 15 |
public enum NodeIcon : int |
| 16 |
{ |
| 17 |
FolderClose = 0, |
| 18 |
FolderOpen, |
| 19 |
FileError, |
| 20 |
FilePlain, |
| 21 |
} |
| 22 |
|
| 23 |
private IActionMediator _mediator; |
| 24 |
public void SetMediator( IActionMediator mediator ) |
| 25 |
{ |
| 26 |
this._mediator = mediator; |
| 27 |
} |
| 28 |
|
| 29 |
#region コンストラクタ |
| 30 |
public ExplorerForm() |
| 31 |
{ |
| 32 |
InitializeComponent(); |
| 33 |
} |
| 34 |
|
| 35 |
public ExplorerForm( TreeNode root ) |
| 36 |
{ |
| 37 |
InitializeComponent(); |
| 38 |
|
| 39 |
BindExplorerTree( root ); |
| 40 |
} |
| 41 |
#endregion |
| 42 |
|
| 43 |
public WeifenLuo.WinFormsUI.Docking.DockState DefaultDockState |
| 44 |
{ |
| 45 |
get { return WeifenLuo.WinFormsUI.Docking.DockState.DockLeft; } |
| 46 |
} |
| 47 |
public void Reflesh() |
| 48 |
{ |
| 49 |
this.treeExplorer.Refresh(); |
| 50 |
} |
| 51 |
public void Bind( Model model ) |
| 52 |
{ |
| 53 |
ExplorerModel exModel; |
| 54 |
if ( model.TryGetModelImpl( out exModel ) ) |
| 55 |
{ |
| 56 |
BindExplorerTree( exModel.ExplorerTree ); |
| 57 |
} |
| 58 |
} |
| 59 |
public void Initialize() { } |
| 60 |
|
| 61 |
private void BindExplorerTree( TreeNode root ) |
| 62 |
{ |
| 63 |
if ( root != null ) |
| 64 |
{ |
| 65 |
this.treeExplorer.BeginUpdate(); |
| 66 |
|
| 67 |
try |
| 68 |
{ |
| 69 |
this.treeExplorer.Nodes.Clear(); |
| 70 |
this.treeExplorer.Nodes.Add( root ); |
| 71 |
//this.treeExplorer.ExpandAll(); |
| 72 |
} |
| 73 |
finally |
| 74 |
{ |
| 75 |
this.treeExplorer.EndUpdate(); |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
private void treeExplorer_NodeMouseDoubleClick( object sender, TreeNodeMouseClickEventArgs e ) |
| 81 |
{ |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
private void treeExplorer_BeforeExpand( object sender, TreeViewCancelEventArgs e ) |
| 86 |
{ |
| 87 |
this._mediator.DispatchAction( new SomaliActionArgs( SomaliAction.ExpandExplorerNode, e.Node ) ); |
| 88 |
} |
| 89 |
|
| 90 |
} |
| 91 |
} |