private void DeleteClass(object sender, EventArgs e) { MultipurposePopup AreYouSure = new MultipurposePopup("This will delete all Files for this class. Are you sure?", "", false); var Result = AreYouSure.ShowDialog(); if (Result == DialogResult.OK) { this?.Invoke((NoArgDelegate)BeginLoading); //ControlHelper.SuspendDrawing(ResourcePanel); //ControlHelper.SuspendDrawing(ClassesPanel); MenuItem MenuSender = (MenuItem)sender; string DeleteName = MenuSender.Name; ClassClick?.Invoke(DeleteName); Thread t = new Thread(() => DeleteClassHelper(DeleteName)); t.Start(); } }
/// <summary> /// This function is called when a Class Item is clicked. It sets the name of the current class and takes /// care of the transition from the ClassesPanel to the ResourcesPanel. It launches the ClassClick event /// so that the controller can get all of the Resources from the server for that class. /// </summary> /// <param name="ClassName"></param> private void ClassClicked(string ClassName) { CurrentClass = ClassName; CurrentClassLabel.Text = CurrentClass.Substring(0, CurrentClass.Length - 3); string BackImage = GetBackImage(ClassName); ResourcePanel.BackgroundImage = System.Drawing.Image.FromFile(BackImage); string Ext = ClassName.Substring(ClassName.Length - 3); CurrentBookColorIdx = ColorExtensions.IndexOf(Ext); CurrentBookColorComplement = GetComplement(CurrentBookColorIdx); ClassView = false; MoveUpThread = new Thread(new ThreadStart(SwitchToResourcesPanel)); MoveUpThread.Start(); AddFilePanel.Show(); AddLinkPanel.Show(); ClassClick?.Invoke(ClassName); }
/// <summary> /// %BG - 0 /// %DB - 1 /// %DP - 2 /// %_G - 3 /// %LB - 4 /// %LP - 5 /// %_O - 6 /// %_P - 7 /// %_R - 8 /// %_Y - 9 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddClassClick(object sender, EventArgs e) { MultipurposePopup ClassNamePopUp = new MultipurposePopup("Choose a class name.", "Class:", true); var Result = ClassNamePopUp.ShowDialog(); if (Result == DialogResult.OK) { string Extension = GetNextColor(); CurrentClass = ClassNamePopUp.MyText + Extension; //DeleteSempahore.Release(); ResourcePanel.BackgroundImage = System.Drawing.Image.FromFile(GetBackImage(CurrentClass)); ClassClick?.Invoke(CurrentClass); CurrentClassLabel.Text = CurrentClass.Substring(0, CurrentClass.Length - 3); AllClasses.Add(CurrentClass); ClassesMediator.Controls.Clear(); UpdateClasses(AllClasses); Thread.Sleep(500); //Give ClassClick time to finish. UploadEvent?.Invoke("_Placeholder to keep new class on server", "_Class_Foot_In_Door", null, null, "true", "false", null); } }