public MainForm()
        {
            InitializeComponent();

            Global.Settings.Load();

            DB = new EntityContext("db.sdf");
            DB.Categories.ToArray();
            DB.Transactions.ToArray();
            DB.Plans.ToArray();

            ApplySettings();

            ToolStripMenuItem item = null;
            // set category icons
            for (int i = 1; i < imageList.Images.Count; i++)
            {
                item = new ToolStripMenuItem(i.ToString(), imageList.Images[i]);
                item.Click += new EventHandler(btnCategoryIcon_Click);
                menuCategoryIcon.DropDownItems.Add(item);
            }

            // set category color
            item = new ToolStripMenuItem("Black"); item.Tag = Color.Black; item.ForeColor = Color.Black; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Green"); item.Tag = Color.Green; item.ForeColor = Color.Green; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Red"); item.Tag = Color.Red; item.ForeColor = Color.Red; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Blue"); item.Tag = Color.Blue; item.ForeColor = Color.Blue; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Gray"); item.Tag = Color.Gray; item.ForeColor = Color.Gray; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Lime"); item.Tag = Color.Lime; item.ForeColor = Color.Lime; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Navy"); item.Tag = Color.Navy; item.ForeColor = Color.Navy; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Orange"); item.Tag = Color.Orange; item.ForeColor = Color.Orange; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Pink"); item.Tag = Color.Pink; item.ForeColor = Color.Pink; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("SkyBlue"); item.Tag = Color.SkyBlue; item.ForeColor = Color.SkyBlue; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Violet"); item.Tag = Color.Violet; item.ForeColor = Color.Violet; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Yellow"); item.Tag = Color.Yellow; item.ForeColor = Color.Yellow; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Gold"); item.Tag = Color.Gold; item.ForeColor = Color.Gold; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);
            item = new ToolStripMenuItem("Silver"); item.Tag = Color.Silver; item.ForeColor = Color.Silver; item.Click += new EventHandler(btnCategoryColor_Click); menuCategoryColor.DropDownItems.Add(item);

            listTrash.ListViewItemSorter = new TrashListViewSorter();

            Period = DateTime.MinValue;
            Order = OrderBy.Date;

            btnOrderByDate.Checked = true;
            btnPeriodAll.Checked = true;

            UpdatePlaning();

            UpdateCategory();
            UpdateAll();

            UpdateTrash();

            comboPlanAddPeriod.SelectedIndex = 1;
            comboPlanAddType.SelectedIndex = 0;

            buttonSave.Enabled = false;
        }
        public MainForm()
        {
            InitializeComponent();

            Global.Settings.Load();

            DB = new EntityContext("db.sdf");

            DB.Categories.ToArray<Category>();
            DB.Books.ToArray<Book>();

            ApplySettings();

            UpdateBookCategory();
            UpdateBooks();
        }
        public MainForm()
        {
            InitializeComponent();

            Global.Settings.Load();

            btnSortDisable.Checked = true;

            DB = new EntityContext("Notes.sdf");
            DB.Notes.ToArray<Note>();

            UpdateNoteList();
            listNote_Resize(this, null);

            ApplySettings();
        }