示例#1
0
        // PUBLIC METHODS /////////////////////////////////////////////////////////////////////////

        #region public methods

        #endregion

        // EVENT HANDLERS /////////////////////////////////////////////////////////////////////////

        #region EventHandlers & standard shmoo

        /// <summary>
        /// Overrides the onload, and defines our Glass margins
        /// </summary>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // sets up the glass power - if possible
            setGlassRegion();

            // sets the height appropriate to the bounds
            this.Size = new Size(10, Screen.GetWorkingArea(this.Bounds).Height);

            // initialize variables
            loadSettings();

            // set locations
            this.hiddenLoc   = new Point(Screen.GetBounds(this.Bounds).Width, Screen.GetBounds(this.Bounds).Y);
            this.unHiddenLoc = new Point(Screen.GetBounds(this.Bounds).Width - this.Width, Screen.GetBounds(this.Bounds).Y);

            if (hideEnabled)
            {
                this.Location = hiddenLoc;
                hiddenBar.Show();
            }
            else
            {
                this.Location = unHiddenLoc;
                RegisterBar(true);
            }

            // read note-file ...
            if (!File.Exists(notePath))
            {
                return;
            }

            try
            {
                StringBuilder sb = new StringBuilder();
                StreamReader  sr = new StreamReader(notePath);

                txtNote.Text = sr.ReadToEnd();
                sr.Close();
            }
            catch
            {
                MessageBox.Show("Barn's SideBar: Error: Couldn't read .note-file at: " + notePath, "Barn's SideBar: Error reading .note", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }