Esempio n. 1
0
        /// <summary>
        /// 항목을 추가합니다.
        /// </summary>
        /// <param name="source">소스 입니다.</param>
        public static void InsertItem(TimeModel source)
        {
            using (SQLiteConnection connection = new SQLiteConnection(_connection))
            {
                connection.Open();

                using (SQLiteCommand command = new SQLiteCommand(connection))
                {
                    InsertItem(connection, source);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 삭제 버튼 클릭시 동작합니다.
        /// </summary>
        /// <param name="sender">이벤트 발생자 입니다.</param>
        /// <param name="e">이벤트 인자 입니다.</param>
        private void deleteButton_Click(object sender, EventArgs e)
        {
            TimeModel focusItem = this.recordListBox.SelectedItem as TimeModel;

            try
            {
                QueryHelper.DeleteItem(focusItem.Time);

                this.sourceList.Remove(focusItem);

                SetListBoxControlData(this.sourceList);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString());
            }
        }
Esempio n. 3
0
        // Event Method (Private)

        #region mainForm_KeyDown(sender, e) - 키 입력시 동작합니다.

        /// <summary>
        /// 키 입력시 동작합니다.
        /// </summary>
        /// <param name="sender">이벤트 발생자 입니다.</param>
        /// <param name="e">이벤트 인자 입니다.</param>
        private void mainForm_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Space || e.KeyCode == Keys.Enter) && statusMode == StatusMode.Idle)
            {
                this.cubeTimer.Start();
                this.stopwatch.Start();

                SetStatusMode(StatusMode.Start);
            }
            else if ((e.KeyCode == Keys.Space || e.KeyCode == Keys.Enter) && statusMode == StatusMode.Start)
            {
                this.cubeTimer.Stop();
                this.stopwatch.Stop();

                try
                {
                    TimeModel inputItem = GetItemFromControl();

                    QueryHelper.InsertItem(inputItem);

                    this.sourceList.Add(inputItem);

                    SetListBoxControlData(this.sourceList);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                }
                finally
                {
                    SetStatusMode(StatusMode.Stop);
                }
            }
            else if ((e.KeyCode == Keys.Space || e.KeyCode == Keys.Enter) && statusMode == StatusMode.Stop)
            {
                this.stopwatch.Reset();

                ClearLabelText();

                SetStatusMode(StatusMode.Idle);
            }
        }