コード例 #1
0
 private void UnselectAllPublisher_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < PublisherListbox.Items.Count; i++)
     {
         PublisherListbox.SetItemChecked(i, false);
     }
 }
コード例 #2
0
        private void Organizer_Load(object sender, EventArgs e)
        {
            AnnouncementGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            AnnouncementGridView.RowHeadersVisible       = false;
            SetColor();
            Text                       += " " + Program.VERSION;
            FormBorderStyle             = FormBorderStyle.FixedSingle;
            MaximizeBox                 = false;
            SearchButton.Text           = char.ConvertFromUtf32(SearchButton.Text[0]);
            DateSelectBox.SelectedIndex = 3;

            foreach (Announcement a in Program.Announcements)
            {
                if ((DateTime.Today - DateTime.ParseExact(a.Date.Split('T')[0], "yyyy-MM-dd", CultureInfo.InvariantCulture)).Days <= 7)
                {
                    int j = Program.Announcements.IndexOf(a);
                    AnnouncementGridView.Rows.Add(new object[] { j, a.Category, a.Title, a.Publisher.Name, a.Date.Split('T')[0], a.Attachments.Length });
                }
                if (!PublisherListbox.Items.Contains(a.Publisher.Name))
                {
                    PublisherListbox.Items.Add(a.Publisher.Name);
                }
                if (!CategoryListbox.Items.Contains(a.Category))
                {
                    CategoryListbox.Items.Add(a.Category);
                }
            }


            for (int i = 0; i < PublisherListbox.Items.Count; i++)
            {
                PublisherListbox.SetItemChecked(i, true);
            }
            for (int i = 0; i < CategoryListbox.Items.Count; i++)
            {
                CategoryListbox.SetItemChecked(i, true);
            }
            PublisherListbox.Sorted = true;
            CategoryListbox.Sorted  = true;
            AnnouncementGridView.Sort(AnnouncementGridView.Columns["Date"], ListSortDirection.Descending);
            AnnouncementGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing;
            AnnouncementGridView.RowHeadersVisible       = true;
        }