コード例 #1
0
ファイル: SettingsForm.cs プロジェクト: Sonaza/Skedaddler
        private void convertToTimeSpan(TextBox theTextbox, bool canBeNegative)
        {
            TimeSpan time = TimeSpan.Zero;

            // If the timespan is already valid there's no need to do anything more
            if (Skedaddler.parseTimeSpan(theTextbox.Text, out time))
            {
                return;
            }

            if (theTextbox.Text.Length > 0)
            {
                int minutes = 0;
                if (Int32.TryParse(theTextbox.Text, out minutes))
                {
                    time = TimeSpan.FromMinutes(minutes);
                }
            }

            if (time < TimeSpan.Zero && canBeNegative == false)
            {
                time = TimeSpan.Zero;
            }

            theTextbox.Text = (time < TimeSpan.Zero ? "-" : "") + String.Format("{0:h\\:mm}", time);
        }
コード例 #2
0
ファイル: SettingsForm.cs プロジェクト: Sonaza/Skedaddler
        private void adjustTimeSpan(TextBox theTextbox, int value, bool canBeNegative, string defaultValue = "0:00")
        {
            TimeSpan time;

            if (theTextbox.Text.Length == 0 || !Skedaddler.parseTimeSpan(theTextbox.Text, out time))
            {
                theTextbox.Text = defaultValue;
                return;
            }

            time += TimeSpan.FromMinutes(value);
            if (time < TimeSpan.Zero && canBeNegative == false)
            {
                time = TimeSpan.Zero;
            }

            theTextbox.Text = (time < TimeSpan.Zero ? "-" : "") + String.Format("{0:h\\:mm}", time);
        }
コード例 #3
0
ファイル: SettingsForm.cs プロジェクト: Sonaza/Skedaddler
        public SettingsForm(Skedaddler parent)
        {
            InitializeComponent();

            this.parent = parent;
        }