📄 mainform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using YariSoft.Utils;
namespace YariSoft.AgentMovieEditor
{
public class MainForm : System.Windows.Forms.Form
{
#region Protected variables
private const string applicationName = "Movie Editor";
private YariSoft.Utils.AgentPlayer workObject = new AgentPlayer();
private YariSoft.Utils.AgentManager agent = new YariSoft.Utils.AgentManager();
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.ImageList imageList;
private System.Windows.Forms.ToolBar toolBar;
private System.Windows.Forms.ToolBarButton toolSep0;
private System.Windows.Forms.ToolBarButton toolNewButton;
private System.Windows.Forms.ToolBarButton toolOpenButton;
private System.Windows.Forms.ToolBarButton toolSaveButton;
private System.Windows.Forms.ToolBarButton toolSep1;
private System.Windows.Forms.ToolBarButton toolRunButton;
private System.Windows.Forms.TreeView tree;
private System.Windows.Forms.MenuItem fileMenuItem;
private System.Windows.Forms.MenuItem newMenuItem;
private System.Windows.Forms.MenuItem openMenuItem;
private System.Windows.Forms.MenuItem saveMenuItem;
private System.Windows.Forms.MenuItem saveAsMenuItem;
private System.Windows.Forms.MenuItem exitMenuItem;
private System.Windows.Forms.MenuItem helpMenuItem;
private System.Windows.Forms.MenuItem aboutMenuItem;
private System.Windows.Forms.DataGrid grid;
private System.Windows.Forms.Splitter splitter;
private System.Windows.Forms.MenuItem actionMenuItem;
private System.Windows.Forms.ContextMenu popup;
private System.Windows.Forms.MenuItem newActionItem;
private System.Windows.Forms.MenuItem renameActionItem;
private System.Windows.Forms.MenuItem deleteAcionItem;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem newPopupItem;
private System.Windows.Forms.MenuItem renamePopupItem;
private System.Windows.Forms.MenuItem deletePopupItem;
private System.Windows.Forms.MenuItem playActionItem;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.ContextMenu gridPopup;
private System.Windows.Forms.MenuItem newOperationItem;
private System.Windows.Forms.MenuItem deleteOperationItem;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem upOperationItem;
private System.Windows.Forms.MenuItem downOperationItem;
private System.Windows.Forms.MenuItem animationOperationItem;
private System.Windows.Forms.MenuItem talkOperationItem;
private System.Windows.Forms.MenuItem positionOperationItem;
private System.Windows.Forms.MenuItem editOperationItem;
private System.Windows.Forms.ToolBarButton toolSep2;
private System.Windows.Forms.ToolBarButton toolUpButton;
private System.Windows.Forms.ToolBarButton toolDownButton;
private System.Windows.Forms.MenuItem propActionItem;
private System.Windows.Forms.MenuItem menuSep0;
private System.Windows.Forms.MenuItem menuSep1;
private System.Windows.Forms.MenuItem menuSep2;
private System.Windows.Forms.MenuItem menuSep3;
private System.ComponentModel.IContainer components;
#endregion
#region Constructor/Destructor
public MainForm()
{
this.agent.Init( new AgentInfo() );
this.agent.Show();
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
this.agent.Hide();
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
this.tree = new System.Windows.Forms.TreeView();
this.popup = new System.Windows.Forms.ContextMenu();
this.newPopupItem = new System.Windows.Forms.MenuItem();
this.renamePopupItem = new System.Windows.Forms.MenuItem();
this.deletePopupItem = new System.Windows.Forms.MenuItem();
this.newActionItem = new System.Windows.Forms.MenuItem();
this.renameActionItem = new System.Windows.Forms.MenuItem();
this.deleteAcionItem = new System.Windows.Forms.MenuItem();
this.mainMenu = new System.Windows.Forms.MainMenu();
this.fileMenuItem = new System.Windows.Forms.MenuItem();
this.newMenuItem = new System.Windows.Forms.MenuItem();
this.openMenuItem = new System.Windows.Forms.MenuItem();
this.menuSep0 = new System.Windows.Forms.MenuItem();
this.saveMenuItem = new System.Windows.Forms.MenuItem();
this.saveAsMenuItem = new System.Windows.Forms.MenuItem();
this.menuSep1 = new System.Windows.Forms.MenuItem();
this.exitMenuItem = new System.Windows.Forms.MenuItem();
this.actionMenuItem = new System.Windows.Forms.MenuItem();
this.menuSep2 = new System.Windows.Forms.MenuItem();
this.playActionItem = new System.Windows.Forms.MenuItem();
this.menuSep3 = new System.Windows.Forms.MenuItem();
this.propActionItem = new System.Windows.Forms.MenuItem();
this.helpMenuItem = new System.Windows.Forms.MenuItem();
this.aboutMenuItem = new System.Windows.Forms.MenuItem();
this.splitter = new System.Windows.Forms.Splitter();
this.grid = new System.Windows.Forms.DataGrid();
this.gridPopup = new System.Windows.Forms.ContextMenu();
this.newOperationItem = new System.Windows.Forms.MenuItem();
this.animationOperationItem = new System.Windows.Forms.MenuItem();
this.talkOperationItem = new System.Windows.Forms.MenuItem();
this.positionOperationItem = new System.Windows.Forms.MenuItem();
this.editOperationItem = new System.Windows.Forms.MenuItem();
this.deleteOperationItem = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.upOperationItem = new System.Windows.Forms.MenuItem();
this.downOperationItem = new System.Windows.Forms.MenuItem();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.toolBar = new System.Windows.Forms.ToolBar();
this.toolSep0 = new System.Windows.Forms.ToolBarButton();
this.toolNewButton = new System.Windows.Forms.ToolBarButton();
this.toolOpenButton = new System.Windows.Forms.ToolBarButton();
this.toolSaveButton = new System.Windows.Forms.ToolBarButton();
this.toolSep1 = new System.Windows.Forms.ToolBarButton();
this.toolRunButton = new System.Windows.Forms.ToolBarButton();
this.toolSep2 = new System.Windows.Forms.ToolBarButton();
this.toolDownButton = new System.Windows.Forms.ToolBarButton();
this.toolUpButton = new System.Windows.Forms.ToolBarButton();
this.menuItem1 = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
this.SuspendLayout();
//
// tree
//
this.tree.ContextMenu = this.popup;
this.tree.Dock = System.Windows.Forms.DockStyle.Left;
this.tree.ImageIndex = -1;
this.tree.Location = new System.Drawing.Point(0, 25);
this.tree.Name = "tree";
this.tree.SelectedImageIndex = -1;
this.tree.Size = new System.Drawing.Size(170, 320);
this.tree.TabIndex = 0;
this.tree.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tree_MouseDown);
this.tree.DoubleClick += new System.EventHandler(this.tree_DoubleClick);
this.tree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tree_AfterSelect);
//
// popup
//
this.popup.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.newPopupItem,
this.renamePopupItem,
this.deletePopupItem});
//
// newPopupItem
//
this.newPopupItem.Index = 0;
this.newPopupItem.Text = "New";
this.newPopupItem.Click += new System.EventHandler(this.newActionItem_Click);
//
// renamePopupItem
//
this.renamePopupItem.Index = 1;
this.renamePopupItem.Text = "Rename";
this.renamePopupItem.Click += new System.EventHandler(this.renameActionItem_Click);
//
// deletePopupItem
//
this.deletePopupItem.Index = 2;
this.deletePopupItem.Text = "Delete";
this.deletePopupItem.Click += new System.EventHandler(this.deleteAcionItem_Click);
//
// newActionItem
//
this.newActionItem.Index = 0;
this.newActionItem.Text = "&New";
this.newActionItem.Click += new System.EventHandler(this.newActionItem_Click);
//
// renameActionItem
//
this.renameActionItem.Index = 1;
this.renameActionItem.Text = "&Rename";
this.renameActionItem.Click += new System.EventHandler(this.renameActionItem_Click);
//
// deleteAcionItem
//
this.deleteAcionItem.Index = 2;
this.deleteAcionItem.Text = "&Delete";
this.deleteAcionItem.Click += new System.EventHandler(this.deleteAcionItem_Click);
//
// mainMenu
//
this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.fileMenuItem,
this.actionMenuItem,
this.helpMenuItem});
//
// fileMenuItem
//
this.fileMenuItem.Index = 0;
this.fileMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.newMenuItem,
this.openMenuItem,
this.menuSep0,
this.saveMenuItem,
this.saveAsMenuItem,
this.menuSep1,
this.exitMenuItem});
this.fileMenuItem.Text = "&File";
//
// newMenuItem
//
this.newMenuItem.Index = 0;
this.newMenuItem.Text = "&New";
this.newMenuItem.Click += new System.EventHandler(this.newMenuItem_Click);
//
// openMenuItem
//
this.openMenuItem.Index = 1;
this.openMenuItem.Text = "&Open";
this.openMenuItem.Click += new System.EventHandler(this.openMenuItem_Click);
//
// menuSep0
//
this.menuSep0.Index = 2;
this.menuSep0.Text = "-";
//
// saveMenuItem
//
this.saveMenuItem.Index = 3;
this.saveMenuItem.Text = "&Save";
this.saveMenuItem.Click += new System.EventHandler(this.saveMenuItem_Click);
//
// saveAsMenuItem
//
this.saveAsMenuItem.Index = 4;
this.saveAsMenuItem.Text = "Save &As...";
this.saveAsMenuItem.Click += new System.EventHandler(this.saveAsMenuItem_Click);
//
// menuSep1
//
this.menuSep1.Index = 5;
this.menuSep1.Text = "-";
//
// exitMenuItem
//
this.exitMenuItem.Index = 6;
this.exitMenuItem.Text = "&Exit";
this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
//
// actionMenuItem
//
this.actionMenuItem.Index = 1;
this.actionMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.newActionItem,
this.renameActionItem,
this.deleteAcionItem,
this.menuSep2,
this.playActionItem,
this.menuSep3,
this.propActionItem});
this.actionMenuItem.Text = "&Action";
//
// menuSep2
//
this.menuSep2.Index = 3;
this.menuSep2.Text = "-";
//
// playActionItem
//
this.playActionItem.Index = 4;
this.playActionItem.Text = "&Play";
this.playActionItem.Click += new System.EventHandler(this.playActionItem_Click);
//
// menuSep3
//
this.menuSep3.Index = 5;
this.menuSep3.Text = "-";
//
// propActionItem
//
this.propActionItem.Index = 6;
this.propActionItem.Text = "Agent &Properties";
this.propActionItem.Click += new System.EventHandler(this.propActionItem_Click);
//
// helpMenuItem
//
this.helpMenuItem.Index = 2;
this.helpMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.aboutMenuItem});
this.helpMenuItem.Text = "&Help";
//
// aboutMenuItem
//
this.aboutMenuItem.Index = 0;
this.aboutMenuItem.Text = "&About";
this.aboutMenuItem.Click += new System.EventHandler(this.aboutMenuItem_Click);
//
// splitter
//
this.splitter.Location = new System.Drawing.Point(170, 25);
this.splitter.Name = "splitter";
this.splitter.Size = new System.Drawing.Size(3, 320);
this.splitter.TabIndex = 2;
this.splitter.TabStop = false;
//
// grid
//
this.grid.AllowNavigation = false;
this.grid.AllowSorting = false;
this.grid.CaptionVisible = false;
this.grid.ContextMenu = this.gridPopup;
this.grid.DataMember = "";
this.grid.Dock = System.Windows.Forms.DockStyle.Fill;
this.grid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.grid.Location = new System.Drawing.Point(173, 25);
this.grid.Name = "grid";
this.grid.ParentRowsVisible = false;
this.grid.ReadOnly = true;
this.grid.RowHeadersVisible = false;
this.grid.Size = new System.Drawing.Size(259, 320);
this.grid.TabIndex = 3;
this.grid.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.dataGridTableStyle1});
this.grid.DoubleClick += new System.EventHandler(this.grid_DoubleClick);
this.grid.MouseUp += new System.Windows.Forms.MouseEventHandler(this.grid_MouseUp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -