Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.IconDatabase = new IconDatabase();

            // toolbar
            viewHelpHelpMenuItem.Enabled = File.Exists(Path.ChangeExtension(Application.ExecutablePath, ".chm"));

            string iconDBPath = Path.ChangeExtension(Application.ExecutablePath, ".db");
            bool   rv         = false;

            if (File.Exists(iconDBPath))
            {
                rv = this.IconDatabase.LoadFile(iconDBPath);
                if (!rv)
                {
                    rv = this.IconDatabase.CreateSpecial(iconDBPath, true);
                    if (!rv)
                    {
                        MessageBox.Show("Can not find icon database. [" + this.IconDatabase.LastError + "]");
                        this.Close();
                    }
                }
            }
            else
            {
                rv = this.IconDatabase.CreateSpecial(iconDBPath, true);
                if (!rv)
                {
                    MessageBox.Show("Can not find icon database. [" + this.IconDatabase.LastError + "]");
                    this.Close();
                }
            }

            treeView1.IconDatabase = this.IconDatabase;
            sessionFileFormat      = new SessionFileFormat(this);
            this.ApplicationMode   = AppMode.Clear;

            treeView1.OnNodeCountUpdate = delegate(ulong v) {
                statusBarPanel2.Text = v.ToString();
            };
            treeView1.OnChanged = delegate(object sender, EventArgs ev) {
                if (this.ApplicationMode == AppMode.New)
                {
                    saveMenuBarItem.Enabled = saveFileMenuItem.Enabled = false;
                }
                else
                {
                    saveMenuBarItem.Enabled = saveFileMenuItem.Enabled = treeView1.HasChanged;
                }
            };
        }