示例#1
0
        private void changeFormPosition(Direction direction, string comment)
        {
            int numberOfPixels = Int32.Parse(Regex.Match(comment, @"\d+$").Value);

            if (direction == Direction.Up)
            {
                CommentSetting.PositionTop -= numberOfPixels;
            }
            else if (direction == Direction.Right)
            {
                CommentSetting.PositionLeft += numberOfPixels;
            }
            else if (direction == Direction.Left)
            {
                CommentSetting.PositionLeft -= numberOfPixels;
            }
            else if (direction == Direction.Down)
            {
                CommentSetting.PositionTop += numberOfPixels;
            }
            else
            {
                throw new Exception("Wtf are you doing passing a nondirectional direction to this method?");
            }

            ScreenPositionHelper.UpdateScreenPosition(this, _screen);
        }
示例#2
0
        private void positionForm(string comment)
        {
            //Split by a space.
            string[] split = comment.Split((char)32);

            if (split.Length < 2)
            {
                return;
            }

            ScreenPosition position = ScreenPositionHelper.GetFromString(split[1]);

            ScreenPositionHelper.DockForm(this, this._screen, position);
            CommentSetting.Position = position.ToString();
        }
示例#3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txtComments.Text))
            {
                var       comment   = txtComments.Text.Trim();
                Direction direction = DirectionTranslator.TranslateString(comment);

                if (comment == "/exit" || comment == "/e" || comment == "/x")
                {
                    Application.Exit();
                }
                else if (comment == "/review" || comment == "/time" || comment == "/r" || comment == "/tr" || comment == "/timereview")
                {
                    displayTimeReview();
                }
                else if (comment == "/help" || comment == "/h")
                {
                    displayHelpMenu();
                }
                else if (comment == "/reminder" || comment == "/r")
                {
                    displayReminderSettings();
                }
                else if (comment.Contains("/pos") || comment.Contains("/position"))
                {
                    positionForm(comment);
                }
                else if (comment.Contains("/screen"))
                {
                    changeScreen(comment);
                    ScreenPositionHelper.UpdateScreenPosition(this, _screen);
                }
                else if (direction != Direction.Nondirectional)
                {
                    changeFormPosition(direction, comment);
                }
                else
                {
                    InsertLog(comment);
                }

                txtComments.Text = string.Empty;
                txtComments.Focus();
            }
        }
示例#4
0
        private void Comments_Load(object sender, EventArgs e)
        {
            //Position textbox
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            _screenPosition      = ScreenPositionHelper.GetFromString(CommentSetting.Position);

            if (Screen.AllScreens.Length == 1)
            {
                _screen = Screen.PrimaryScreen;
            }
            else
            {
                _screen = Screen.AllScreens[CommentSetting.Screen];
            }

            ScreenPositionHelper.UpdateScreenPosition(this, _screen);

            txtComments.Text = default(string);
            this.Opacity     = CommentSetting.Opacity;
        }