//private Font listBoxFestivalBooks_Font = new Font("Helvetica", 10f); //private StringFormat listBoxFestivalBooks_Format = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center }; private void listBoxFestivalBooks_SelectedIndexChanged(object sender, EventArgs e) { if (changingFilter) { return; } changingFilter = true; textBox1.Text = ""; int si = listBoxFestivalBooks.SelectedIndex; if (listBoxFestivalBooks.Items.Count > si && si >= 0) { if (listBoxFestivalBooks.Items[si] is GCFestivalBook) { filterToBook = (GCFestivalBook)listBoxFestivalBooks.Items[si]; } else { filterToBook = null; } } FillListView(); changingFilter = false; }
private void buttonItems_Click(object sender, EventArgs e) { int index = listBox1.SelectedIndex; if (index >= 0 && index < listBox1.Items.Count) { GCFestivalBook fb = GetBook(index); Controller.Parent.ExecuteMessage("setTabChanged", new GSString("events")); Controller.Parent.ExecuteMessage("currExec", new GSString("setCollection"), new GSNumber(fb.CollectionId)); } }
private void buttonAdd_Click(object sender, EventArgs e) { DlgEditFestivalBook d = new DlgEditFestivalBook(); d.CollectionTitle = string.Format("Events {0}", GCFestivalBookCollection.BookCollectionIdCounter); if (d.ShowDialog() == DialogResult.OK) { GCFestivalBook fb = GCFestivalBookCollection.CreateBook(d.CollectionTitle); listBox1.Items.Add(fb); } }
private void buttonShowHide_Click(object sender, EventArgs e) { int index = listBox1.SelectedIndex; if (index >= 0 && index < listBox1.Items.Count) { GCFestivalBook fb = GCFestivalBookCollection.Books[index]; fb.Visible = !fb.Visible; fb.Changed = true; listBox1.Invalidate(); //no needed saving, because there is only order of books in the root file //GCFestivalBookCollection.SaveRootFile(); } }
private void onDeleteEvent(object sender, EventArgs e) { if (sender is AskDeleteObject) { AskDeleteObject dlg = sender as AskDeleteObject; GCFestivalBase fb = dlg.Tag as GCFestivalBase; if (fb != null) { GCFestivalBook book = GCFestivalBookCollection.getSafeBook(fb.BookID); book.Remove(fb); onNonDeleteEvent(sender, e); RemoveItemFromListBox(fb); } } }
private void buttonEdit_Click(object sender, EventArgs e) { int index = listBox1.SelectedIndex; if (index >= 0 && index < listBox1.Items.Count) { DlgEditFestivalBook d = new DlgEditFestivalBook(); GCFestivalBook fb = GetBook(index); d.CollectionTitle = fb.CollectionName; if (d.ShowDialog() == DialogResult.OK && !d.CollectionTitle.Equals(fb.CollectionName)) { fb.CollectionName = d.CollectionTitle; fb.Changed = true; listBox1.Invalidate(); } } }
private void buttonRemove_Click(object sender, EventArgs e) { int index = listBox1.SelectedIndex; if (index >= 0 && index < listBox1.Items.Count) { DlgDeleteFestivalBook df = new DlgDeleteFestivalBook(); GCFestivalBook fb = GetBook(index); df.FileNameReimport = Path.Combine(GCGlobal.ConfigurationFolderPath, fb.FileName); if (df.ShowDialog() == DialogResult.Yes) { GCFestivalBookCollection.Books.RemoveAt(index); listBox1.Items.RemoveAt(index); GCFestivalBookCollection.SaveRootFile(); } } }
public void SetCollectionId(int collId) { int i, c = 0; GCFestivalBook newFilterToBook = null; listBoxFestivalBooks.Items.Clear(); listBoxFestivalBooks.Items.Add("All Collections"); for (i = 0; i < GCFestivalBookCollection.Books.Count; i++) { GCFestivalBook fb = GCFestivalBookCollection.Books[i]; if (fb.CollectionId == collId) { newFilterToBook = fb; c = i; } listBoxFestivalBooks.Items.Add(fb); } listBoxFestivalBooks.SelectedIndex = c; }
private void listBox1_DrawItem(object sender, DrawItemEventArgs e) { if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { e.Graphics.FillRectangle(Brushes.LightGreen, e.Bounds); } else { e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds); } Rectangle rc = new Rectangle(e.Bounds.X + e.Bounds.Height + 8, e.Bounds.Y + 2, e.Bounds.Width - e.Bounds.Height - 8, e.Bounds.Height - 4); Rectangle rcImage = new Rectangle(e.Bounds.X + e.Bounds.Height / 2 - 10, e.Bounds.Y + e.Bounds.Height / 2 - 10, 20, 20); GCFestivalBook fb = GetBook(e.Index); if (fb != null) { e.Graphics.DrawString(fb.CollectionName, SystemFonts.CaptionFont, Brushes.Black, rc, stringFormatCenterLeft); e.Graphics.DrawImage(fb.Visible ? Properties.Resources.eye : Properties.Resources.eye2, rcImage); } }
private void buttonOK_Click(object sender, EventArgs e) { if (EventObject != null) { if (EventObject.BookID != editEventBase1.EventBook) { if (EventObject.BookID != -1) { GCFestivalBook oldBook = GCFestivalBookCollection.getSafeBook(EventObject.BookID); oldBook.Remove(EventObject); oldBook.Changed = true; } GCFestivalBook newBook = GCFestivalBookCollection.getSafeBook(editEventBase1.EventBook); EventObject.BookID = editEventBase1.EventBook; newBook.Add(EventObject); newBook.Changed = true; } GCFestivalBook eventBook = GCFestivalBookCollection.getSafeBook(EventObject.BookID); if (EventObject.DayOffset != editEventBase1.DaysOffset) { EventObject.DayOffset = editEventBase1.DaysOffset; eventBook.Changed = true; } if (EventObject.Text != editEventBase1.EventTitle) { EventObject.Text = editEventBase1.EventTitle; eventBook.Changed = true; } if (EventObject.FastingSubject != editEventBase1.EventFastingSubject) { EventObject.FastingSubject = editEventBase1.EventFastingSubject; eventBook.Changed = true; } if (EventObject.StartYear != editEventBase1.EventStartYear) { EventObject.StartYear = editEventBase1.EventStartYear; eventBook.Changed = true; } if (EventObject.FastID != editEventBase1.Fast) { EventObject.FastID = editEventBase1.Fast; eventBook.Changed = true; } if (panelTM != null && EventObject is GCFestivalTithiMasa) { if (panelTM.updateEvent(EventObject as GCFestivalTithiMasa)) { eventBook.Changed = true; } } if (panelMD != null && EventObject is GCFestivalMasaDay) { if (panelMD.updateEvent(EventObject as GCFestivalMasaDay)) { eventBook.Changed = true; } } if (panelS != null && EventObject is GCFestivalSankranti) { if (panelS.updateEvent(EventObject as GCFestivalSankranti)) { eventBook.Changed = true; } } if (panelE != null && EventObject is GCFestivalEkadasi) { if (panelE.updateEvent(EventObject as GCFestivalEkadasi)) { eventBook.Changed = true; } } } if (OnButtonOK != null) { OnButtonOK(this, e); } Controller.RemoveFromContainer(); }
private void buttonOK_Click(object sender, EventArgs e) { bool isNewEvent = false; if (p_related == null) { p_related = new GCFestivalRelated(); isNewEvent = true; } if (p_related != null) { GCFestivalBook book = null; if (p_eventObject.BookID >= 0) { book = GCFestivalBookCollection.getSafeBook(p_eventObject.BookID); } if (p_related.BookID != editEventBase2.EventBook) { p_related.BookID = editEventBase2.EventBook; if (book != null) { book.Changed = true; } } if (p_related.DayOffset != editEventBase2.DaysOffset) { p_related.DayOffset = editEventBase2.DaysOffset; if (book != null) { book.Changed = true; } } if (p_related.FastID != editEventBase2.Fast) { p_related.FastID = editEventBase2.Fast; if (book != null) { book.Changed = true; } } if (p_related.FastingSubject == null || !p_related.FastingSubject.Equals(editEventBase2.EventFastingSubject)) { p_related.FastingSubject = editEventBase2.EventFastingSubject; if (book != null) { book.Changed = true; } } if (p_related.StartYear != editEventBase2.EventStartYear) { p_related.StartYear = editEventBase2.EventStartYear; if (book != null) { book.Changed = true; } } if (p_related.Text == null || !p_related.Text.Equals(editEventBase2.EventTitle)) { p_related.Text = editEventBase2.EventTitle; if (book != null) { book.Changed = true; } } if (isNewEvent) { p_eventObject.AddRelatedFestival(p_related); } p_related = null; if (OnEventDetailChanged != null) { OnEventDetailChanged(this, e); } } Controller.RemoveFromContainer(); }