예제 #1
0
        private void LoadSettings()
        {
            formatDateTimeCheckBox.Checked = Settings.Default.FormatDateTime;

            calendarComboBox.SelectedIndex = -1;
            for (int i = 0; i < Calendars.Length; i++)
            {
                if (Settings.Default.Calendar == Calendars[i])
                {
                    calendarComboBox.SelectedIndex = i;
                    break;
                }
            }

            dateTimePatternTextBox.Text = Settings.Default.DateTimePattern;

            var context = FormUtil.GetFontContext();

            sansSerifTextBox.Text    = FormatFont(context.SansSerif);
            monospaceTextBox.Text    = FormatFont(context.Monospace);
            wordWrapCheckBox.Checked = context.WordWrap;
            if (context.UseSansSerif)
            {
                sansSerifRadioButton.Checked = true;
            }
            else
            {
                monospaceRadioButton.Checked = true;
            }

            UpdateButtonsEnabledProperty();
        }
예제 #2
0
        private void EditTicket()
        {
            if (ticketsListView.SelectedItems.Count != 1)
            {
                return;
            }

            var tag = (Ticket)ticketsListView.SelectedItems[0].Tag;

            using (var form = new TicketDetailsForm(mContext, FormUtil.GetFontContext(), FormUtil.GetFormatter(), Project, tag)) {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                tag.UpdateAndGenerateHistoryRecord(mContext, TicketChangeFormatter.Default, t => {
                    return(form.RetrieveTicket(t));
                });

                // Flush.
                mContext.Flush();

                // Show tickets.
                ShowTickets();

                UpdateTicket(true);
            }
        }
예제 #3
0
        private void ShowTicket()
        {
            if (ticketsListView.SelectedItems.Count != 1)
            {
                return;
            }

            var tag = (Ticket)ticketsListView.SelectedItems[0].Tag;

            using (var form = new TicketDetailsForm(mContext, FormUtil.GetFontContext(), FormUtil.GetFormatter(), Project, tag)) {
                form.ReadOnly = true;
                form.ShowDialog();
            }
        }
예제 #4
0
        private void AddTicket()
        {
            Milestone[] milestones = Project.GetMilestones(mContext);
            if (milestones.Length == 0)
            {
                MessageBox.Show(
                    Resources.String_PleaseAddAMilestoneBeforeAddingATicket,
                    Resources.String_Error,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1,
                    FormUtil.GetMessageBoxOptions(this));
                tabControl.SelectedTab = milestonesTabPage;
                return;
            }

            using (var form = new TicketDetailsForm(mContext, FormUtil.GetFontContext(), FormUtil.GetFormatter(), Project, null)) {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                Ticket ticket = form.RetrieveTicket();

                // Add.
                ticket.Add(mContext);

                // Flush.
                mContext.Flush();

                // Create ticket history entry.
                TicketHistory ticketHistory = ticket.NewHistory(Resources.String_TicketCreated);
                ticketHistory.Add(mContext);

                // Show tickets.
                ShowTickets();

                FormUtil.SelectNew(ticketsListView, ticket);

                UpdateButtonsEnabledProperty();

                ticketsListView.Focus();

                UpdateTicket(true);
            }
        }