public TeacherGetAssignmentListMenuItem(User user, TextViewList textviews) : base("Get List Of Assignments") { this.user = user; this.textviews = textviews; Activated += (sender, e) => new TeacherGetAssignmentListWindow(user, ref textviews); }
public TeacherAddAssignmentMenuItem(User user, TextViewList textviews) : base("Add Assignment") { this.user = user; this.textviews = textviews; Activated += (sender, e) => new TeacherAddAssignmentWindow(user, textviews); }
public TaskGenUnitMenuItem(TextViewList textviews) : base("Unit Conversion") { this.textviews = textviews; this.Activated += delegate { TaskGenUnitWindow window = new TaskGenUnitWindow(this.textviews); }; }
public GeometMenuItem(TextViewList textviews) : base("Geometry Tools") { this.textviews = textviews; this.Activated += delegate { GeometWindow window = new GeometWindow(this.textviews); }; }
public TaskGenAritMenuItem(TextViewList textviews) : base("Arithmetic") { this.textviews = textviews; this.Activated += delegate { TaskGenAritWindow window = new TaskGenAritWindow(this.textviews); }; }
public TaskGenAritWindow(TextViewList textviews) : base("TaskGen Arithmetics Window") { this.textviews = textviews; Table table = new Table(5, 2, true); Label labelMinimum = new Label("Minimum:"); Label labelMaximum = new Label("Maximum:"); Label labelVariables = new Label("Number of variables: "); Label labelNoT = new Label("Number of tasks:"); SpinButton spinbuttonMinimum = new SpinButton(1, 100, 1); SpinButton spinbuttonMaximum = new SpinButton(1, 100, 1); SpinButton spinbuttonVariables = new SpinButton(2, 5, 1); SpinButton spinbuttonNumberOfTasks = new SpinButton(1, 5, 1); spinbuttonMaximum.Value = 20; Button buttonOk = new Button("Ok"); Button buttonCancel = new Button("Cancel"); //Sets the table table.Attach(labelMinimum, 0, 1, 0, 1); table.Attach(spinbuttonMinimum, 1, 2, 0, 1); table.Attach(labelMaximum, 0, 1, 1, 2); table.Attach(spinbuttonMaximum, 1, 2, 1, 2); table.Attach(labelVariables, 0, 1, 2, 3); table.Attach(spinbuttonVariables, 1, 2, 2, 3); table.Attach(labelNoT, 0, 1, 3, 4); table.Attach(spinbuttonNumberOfTasks, 1, 2, 3, 4); table.Attach(buttonCancel, 0, 1, 4, 5); table.Attach(buttonOk, 1, 2, 4, 5); buttonCancel.Clicked += (sender, e) => { this.Destroy(); }; // Generates a number of tasks based on the users input buttonOk.Clicked += (sender, e) => { for (int generatedTaskes = 0; generatedTaskes < spinbuttonNumberOfTasks.Value; generatedTaskes++) { TaskGenLib.Task t = TaskGenLib.TaskGen.MakeCalcTask((int)spinbuttonMinimum.Value, (int)spinbuttonMaximum.Value, (int)spinbuttonVariables.Value); textviews.InsertTaskGenTextView(t.TaskDescription); textviews.InsertResult("", t.Solution); } this.Destroy(); }; Add(table); ShowAll(); }
public BoldToolButton(ref TextViewList textviews) : base(image, "Bold") { this.textviews = textviews; this.TooltipText = "Bold"; SetIcon(); Clicked += delegate { OnBoldClicked(); }; }
public StudentGetAssignmentListWindow(User user, ref TextViewList textviews) : base("Get Assignment List") { this.user = user; this.textviews = textviews; string[] assignmentList = user.student.GetAssignmentList(); ScrolledWindow scrolledWindow = new ScrolledWindow(); VBox vbox = new VBox(false, 2); // For each task on the server that the student has access to, creates a line where the student can get the assignment, upload the completed assignment, and get feedback should any have been given foreach (var assignment in assignmentList) { if (!string.IsNullOrEmpty(assignment)) { HBox hbox = new HBox(false, 2); Label label = new Label(assignment); Button GetAssignment = new Button("Get Assignment"); GetAssignment.Clicked += (sender, e) => new StudentGetAssignmentWindow(this.user, ref this.textviews, assignment); GetAssignment.Clicked += (sender, e) => this.Destroy(); Button AddCompleted = new Button("Add Completed"); AddCompleted.Clicked += (sender, e) => new StudentAddCompletedWindow(this.user, this.textviews, assignment); AddCompleted.Clicked += (sender, e) => this.Destroy(); Button GetFeedback = new Button("Get Feedback"); GetFeedback.Clicked += (sender, e) => new StudentGetFeedbackWindow(this.user, ref this.textviews, assignment); GetFeedback.Clicked += (sender, e) => this.Destroy(); hbox.Add(label); hbox.Add(GetAssignment); hbox.Add(AddCompleted); hbox.Add(GetFeedback); vbox.Add(hbox); } else { MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "No assignment"); ms.Run(); ms.Destroy(); } } scrolledWindow.Add(vbox); Add(scrolledWindow); SetDefaultSize(300, 200); ShowAll(); }
public OpenToolButton(TextViewList textviews, ref User user) : base(image, "open") { SetIcon(); this.TooltipText = "Open .CAS file"; this.textviews = textviews; this.user = user; this.Clicked += delegate { OpenFile(); }; }
public StudentGetAssignmentWindow(User user, ref TextViewList textviews, string Filename) : base("Get Assignment") { this.user = user; this.textviews = textviews; this.Filename = Filename; SetSizeRequest(300, 300); string assignment = this.user.student.GetAssignment(this.Filename); List <MetaType> metaTypeList = ImEx.Import.DeserializeString <List <MetaType> >(assignment); this.textviews.castextviews.Clear(); // Loads each element into the workspace foreach (var metaItem in metaTypeList) { if (metaItem.type == typeof(MovableCasCalcView)) { this.textviews.InsertCalcView(metaItem.metastring, metaItem.locked); } else if (metaItem.type == typeof(MovableCasCalcMulitlineView)) { this.textviews.InsertCalcMultilineView(metaItem.metastring, metaItem.locked); } else if (metaItem.type == typeof(MovableCasResult)) { CasResult.FacitContainer facitcontainer = Import.DeserializeString <CasResult.FacitContainer>(metaItem.metastring); this.textviews.InsertResult(facitcontainer.answer, facitcontainer.facit); } else if (metaItem.type == typeof(MovableCasTextView)) { this.textviews.InsertTextView(metaItem.metastring, metaItem.locked, -1); } } this.textviews.castextviews.Reverse(); this.textviews.Clear(); this.textviews.Redraw(); this.textviews.Reevaluate(); this.textviews.ShowAll(); MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Got assignment"); ms.Run(); ms.Destroy(); Destroy(); }
public MovableResultToolButton(ref TextViewList textviews) : base(image, "Result") { this.textviews = textviews; this.TooltipText = "Set fixed result"; SetIcon(); this.Clicked += delegate { OnActivated(); }; }
public ItalicToolButton(ref TextViewList textviews) : base(image, "Italic") { this.textviews = textviews; this.TooltipText = "Italic"; SetIcon(); Clicked += delegate { OnItalicClicked(); }; }
public MovableCalcViewToolButton(ref TextViewList textviews) : base(image, "Movable Calc View") { this.textviews = textviews; this.TooltipText = "Casculator"; SetIcon(); this.Clicked += delegate { OnActivated(); }; }
public UnderlineToolButton(ref TextViewList textviews) : base(image, "Underline") { this.textviews = textviews; SetIcon(); this.TooltipText = "Underline"; Clicked += delegate { OnUnderlineClicked(); }; }
public MovableDrawCanvasToolButton(ref TextViewList textviews) : base(image, "Movable Draw Canvas") { this.textviews = textviews; this.TooltipText = "Draw"; SetIcon(); this.Clicked += delegate { OnActivated(); }; }
public SaveToolButton(TextViewList textviews) : base(image, "Save") { SetIcon(); this.TooltipText = "Save .CAS file"; this.textviews = textviews; this.Clicked += delegate { SaveFile(); }; }
public MovableCasCalcMultilineToolButton(ref TextViewList textviews) : base(image, "Multiline CalcView") { this.textviews = textviews; TooltipText = "Multiline CalcView"; SetIcon(); Clicked += delegate { OnActivated(); }; }
public NewToolButton(TextViewList textviews) : base(image, "New") { SetIcon(); this.TooltipText = "New .CAS file"; this.Clicked += delegate { textviews.castextviews.Clear(); textviews.Clear(); textviews.Redraw(); textviews.ShowAll(); }; }
public TeacherGetAssignmentListWindow(User user, ref TextViewList textviews) : base("Assignment List") { this.user = user; this.textviews = textviews; string[] assignmentList = user.teacher.GetAssignmentList(); ScrolledWindow scrolledWindow = new ScrolledWindow(); VBox vbox = new VBox(false, 2); // Creates a list of lines, where the teacher can get the complete work of the student, and add feedback for it. foreach (var item in assignmentList) { if (!string.IsNullOrEmpty(item)) { Label label = new Label(item); Button GetCompleted = new Button("Get Completed"); GetCompleted.Clicked += (sender, e) => new TeacherGetCompletedListWindow(this.user, ref this.textviews, item); GetCompleted.Clicked += (sender, e) => this.Destroy(); Button AddFeedback = new Button("Add Feedback"); AddFeedback.Clicked += (sender, e) => new TeacherAddFeedbackWindow(this.user, this.textviews, item); GetCompleted.Clicked += (sender, e) => this.Destroy(); HBox hbox = new HBox(false, 2); hbox.Add(label); hbox.Add(GetCompleted); hbox.Add(AddFeedback); vbox.Add(hbox); } } scrolledWindow.Add(vbox); Add(scrolledWindow); SetDefaultSize(300, 200); ShowAll(); }
public StudentAddCompletedWindow(User user, TextViewList textviews, string Filename) : base("Upload Completed Assignment") { this.user = user; this.textviews = textviews; this.Filename = Filename; SetDefaultSize(300, 300); List <MetaType> metaTypeList = new List <MetaType>(); // Packs the file into a single string foreach (Widget w in this.textviews) { if (w is MovableCasCalcView) { MetaType metaType = new MetaType(); MovableCasCalcView calcView = (MovableCasCalcView)w; metaType.type = typeof(MovableCasCalcView); metaType.metastring = calcView.calcview.input.Text; metaType.locked = calcView.textview.locked; metaTypeList.Add(metaType); } else if (w is MovableCasCalcMulitlineView) { MetaType metaType = new MetaType(); MovableCasCalcMulitlineView calcview = (MovableCasCalcMulitlineView)w; metaType.type = typeof(MovableCasCalcMulitlineView); metaType.metastring = calcview.calcview.SerializeCasTextView(); metaType.locked = calcview.textview.locked; metaTypeList.Add(metaType); } else if (w is MovableCasResult) { MetaType metaType = new MetaType(); MovableCasResult casres = (MovableCasResult)w; metaType.type = typeof(MovableCasResult); metaType.metastring = Export.Serialize(casres.casresult.facitContainer); metaType.locked = casres.textview.locked; metaTypeList.Add(metaType); } else if (w.GetType() == typeof(MovableCasTextView)) { MetaType metaType = new MetaType(); MovableCasTextView textView = (MovableCasTextView)w; metaType.type = typeof(MovableCasTextView); metaType.metastring = textView.textview.SerializeCasTextView(); metaType.locked = textView.textview.locked; metaTypeList.Add(metaType); } } if (metaTypeList.Count != 0 && !string.IsNullOrEmpty(this.Filename)) { string serializedString = ImEx.Export.Serialize(metaTypeList); this.user.student.AddCompleted(serializedString, this.Filename); MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Upload Successful"); ms.Run(); ms.Destroy(); } else { MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Close, "Upload failed"); ms.Run(); ms.Destroy(); } Destroy(); }
public TaskGenMenuItem(TextViewList textviews) : base("Task Gen") { }
// Constructor for teacheraddfeedbackwindow public TeacherAddFeedbackWindow(User user, TextViewList textviews, string Filename) : base("Add Feedback") { this.user = user; this.textviews = textviews; this.Filename = Filename; SetSizeRequest(300, 300); Grid grid = new Grid(); Label labClass = new Label("Class:"); Entry entClass = new Entry(); entClass.Changed += (e, arg) => { className = entClass.Text; }; Button buttonCancel = new Button("Cancel"); buttonCancel.Clicked += delegate { Destroy(); }; Button buttonFeedback = new Button("Feedback"); buttonFeedback.Clicked += delegate { string feedbackString = String.Empty; List <MetaType> metaTypeList = new List <MetaType>(); // Packs the workspace into a single string for easy transfer foreach (Widget w in this.textviews) { if (w.GetType() == typeof(MovableCasCalcView)) { MetaType metaType = new MetaType(); MovableCasCalcView calcView = (MovableCasCalcView)w; metaType.type = typeof(MovableCasCalcView); metaType.metastring = calcView.calcview.input.Text; metaType.locked = calcView.textview.locked; metaTypeList.Add(metaType); } else if (w is MovableCasCalcMulitlineView) { MetaType metaType = new MetaType(); MovableCasCalcMulitlineView calcview = (MovableCasCalcMulitlineView)w; metaType.type = typeof(MovableCasCalcMulitlineView); metaType.metastring = calcview.calcview.SerializeCasTextView(); metaType.locked = calcview.textview.locked; metaTypeList.Add(metaType); } else if (w is MovableCasResult) { MetaType metaType = new MetaType(); MovableCasResult casres = (MovableCasResult)w; metaType.type = typeof(MovableCasResult); metaType.metastring = Export.Serialize(casres.casresult.facitContainer); metaType.locked = casres.textview.locked; metaTypeList.Add(metaType); } else if (w.GetType() == typeof(MovableCasTextView)) { MetaType metaType = new MetaType(); MovableCasTextView textView = (MovableCasTextView)w; metaType.type = typeof(MovableCasTextView); metaType.metastring = textView.textview.SerializeCasTextView(); metaType.locked = textView.textview.locked; metaTypeList.Add(metaType); } } if (metaTypeList.Count != 0 && string.IsNullOrEmpty(className) == false && string.IsNullOrEmpty(this.Filename) == false) { feedbackString = Export.Serialize(metaTypeList); } string[] StudentList = this.user.teacher.GetCompletedList(this.Filename, className); grid.Destroy(); grid = new Grid(); for (int i = 0; i < StudentList.Length / 2; i++) { int j = 2 * i; Button button = new Button(StudentList[j]); button.Clicked += delegate { this.user.teacher.AddFeedback(feedbackString, this.Filename, StudentList[j], className); MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Added feedback"); ms.Run(); ms.Destroy(); Destroy(); }; grid.Attach(button, 1, 1 + i, 1, 1); } Add(grid); ShowAll(); }; grid.Attach(labClass, 1, 1, 1, 1); grid.Attach(entClass, 2, 1, 1, 1); grid.Attach(buttonCancel, 1, 3, 1, 1); grid.Attach(buttonFeedback, 2, 3, 1, 1); Add(grid); ShowAll(); }
public TeacherGetCompletedListWindow(User user, ref TextViewList textviews, string Filename) : base("Get List of Completed Students") { this.user = user; this.textviews = textviews; this.Filename = Filename; SetSizeRequest(300, 300); Grid grid = new Grid(); Label GradeLabel = new Label("Grade:"); Entry GradeEntry = new Entry(); GradeEntry.WidthRequest = 200; Button CancelButton = new Button("Cancel"); CancelButton.Clicked += delegate { Destroy(); }; // Gets the completed task from the server Button DownloadButton = new Button("List of Completed Students"); DownloadButton.Clicked += (sender, e) => { StudentList = this.user.teacher.GetCompletedList(this.Filename, GradeEntry.Text); foreach (Widget widget in grid) { grid.Remove(widget); } for (int i = 0; i < StudentList.Length / 2; i++) { Button button = new Button(StudentList[2 * i]); button.TooltipText = StudentList[2 * i]; button.HasTooltip = false; Label label = new Label(StudentList[(2 * i) + 1]); button.Clicked += delegate { string completed = this.user.teacher.GetCompleted(button.TooltipText, this.Filename, GradeEntry.Text); MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Got assignment"); ms.Run(); ms.Destroy(); LoadWorkspace(completed); }; grid.Attach(button, 1, 1 + i, 1, 1); grid.Attach(label, 2, 1 + i, 1, 1); ShowAll(); } }; grid.Attach(GradeLabel, 2, 1, 1, 1); grid.Attach(GradeEntry, 2, 2, 1, 1); grid.Attach(DownloadButton, 1, 3, 1, 1); grid.Attach(CancelButton, 2, 3, 1, 1); Add(grid); ShowAll(); }
// Constructor for Geometwindow public GeometWindow(TextViewList textviews) : base("Geometry Tools") { this.textviews = textviews; double radius, length, width, height; Table table = new Table(16, 2, true); string[] sInput; Label labelCircle = new Label(); labelCircle.Markup = "<b> Circle: </b>"; labelCircle.SetAlignment(0, 2); Label labelCircleCircumference = new Label("Circumference (radius): "); Entry entryCircleCircumference = new Entry(""); labelCircleCircumference.SetAlignment(0, 2); entryCircleCircumference.Activated += (o, a) => { radius = 0; double.TryParse(entryCircleCircumference.Text, out radius); entryCircleCircumference.Text = Geomet.Circle.Circumference(radius).ToString(); }; Label labelCircleArea = new Label("Area (radius):"); Entry entryCircleArea = new Entry(""); labelCircleArea.SetAlignment(0, 2); entryCircleArea.Activated += (o, a) => { radius = 0; double.TryParse(entryCircleArea.Text, out radius); entryCircleArea.Text = Geomet.Circle.Area(radius).ToString(); }; Label labelSquare = new Label(); labelSquare.Markup = "<b> Square: </b>"; labelSquare.SetAlignment(0, 2); Label labelSquareCircumference = new Label("Circumference (width; length): "); labelSquareCircumference.SetAlignment(0, 2); Entry entrySquareCircumference = new Entry(""); entrySquareCircumference.Activated += (o, a) => { sInput = entrySquareCircumference.Text.Split(';'); if (sInput.Length == 2 && double.TryParse(sInput[0], out width) && double.TryParse(sInput[1], out length)) { entrySquareCircumference.Text = Geomet.Square.Circumference(width, length).ToString(); } else { entrySquareCircumference.Text = "0"; } }; Label labelSquareArea = new Label("Area (width; length): "); labelSquareArea.SetAlignment(0, 2); Entry entrySquareArea = new Entry(""); entrySquareArea.Activated += (o, a) => { sInput = entrySquareArea.Text.Split(';'); if (sInput.Length == 2 && double.TryParse(sInput[0], out width) && double.TryParse(sInput[1], out length)) { entrySquareArea.Text = Geomet.Square.Area(width, length).ToString(); } else { entrySquareArea.Text = "0"; } }; Label labelSphere = new Label(); labelSphere.Markup = "<b> Sphere: </b>"; labelSphere.SetAlignment(0, 2); Label labelSphereVolume = new Label("Volume (radius): "); labelSphereVolume.SetAlignment(0, 2); Entry entrySphereVolume = new Entry(""); entrySphereVolume.Activated += (o, a) => { radius = 0; double.TryParse(entrySphereVolume.Text, out radius); entrySphereVolume.Text = Geomet.Sphere.Volume(radius).ToString(); }; Label labelSphereSurfaceArea = new Label("Surface area (radius):"); labelSphereSurfaceArea.SetAlignment(0, 2); Entry entrySphereSurfaceArea = new Entry(""); entrySphereSurfaceArea.Activated += (o, a) => { radius = 0; double.TryParse(entrySphereSurfaceArea.Text, out radius); entrySphereSurfaceArea.Text = Geomet.Sphere.SurfaceArea(radius).ToString(); }; Label labelCube = new Label(); labelCube.Markup = "<b> Cube: </b>"; labelCube.SetAlignment(0, 2); Label labelCubeVolume = new Label("Volume (length; width; height): "); labelCubeVolume.SetAlignment(0, 2); Entry entryCubeVolume = new Entry(""); entryCubeVolume.Activated += (o, a) => { sInput = entryCubeVolume.Text.Split(';'); if (sInput.Length == 3 && double.TryParse(sInput[0], out length) && double.TryParse(sInput[1], out width) && double.TryParse(sInput[2], out height)) { entryCubeVolume.Text = Geomet.Cube.Volume(length, width, height).ToString(); } else { entryCubeVolume.Text = "0"; } }; Label labelCubeSurfaceArea = new Label("Surface area (length; width; height):"); Entry entryCubeSurfaceArea = new Entry(""); entryCubeSurfaceArea.Activated += (o, a) => { sInput = entryCubeSurfaceArea.Text.Split(';'); if (sInput.Length == 3 && double.TryParse(sInput[0], out length) && double.TryParse(sInput[1], out width) && double.TryParse(sInput[2], out height)) { entryCubeSurfaceArea.Text = Geomet.Cube.SurfaceArea(length, width, height).ToString(); } else { entryCubeSurfaceArea.Text = "0"; } }; //Sets the table table.Attach(labelCircle, 0, 1, 0, 1); table.Attach(labelCircleCircumference, 0, 1, 1, 2); table.Attach(entryCircleCircumference, 1, 2, 1, 2); table.Attach(labelCircleArea, 0, 1, 2, 3); table.Attach(entryCircleArea, 1, 2, 2, 3); table.Attach(labelSquare, 0, 1, 4, 5); table.Attach(labelSquareCircumference, 0, 1, 5, 6); table.Attach(entrySquareCircumference, 1, 2, 5, 6); table.Attach(labelSquareArea, 0, 1, 6, 7); table.Attach(entrySquareArea, 1, 2, 6, 7); table.Attach(labelSphere, 0, 1, 8, 9); table.Attach(labelSphereSurfaceArea, 0, 1, 9, 10); table.Attach(entrySphereSurfaceArea, 1, 2, 9, 10); table.Attach(labelSphereVolume, 0, 1, 10, 11); table.Attach(entrySphereVolume, 1, 2, 10, 11); table.Attach(labelCube, 0, 1, 12, 13); table.Attach(labelCubeSurfaceArea, 0, 1, 13, 14); table.Attach(entryCubeSurfaceArea, 1, 2, 13, 14); table.Attach(labelCubeVolume, 0, 1, 14, 15); table.Attach(entryCubeVolume, 1, 2, 14, 15); Add(table); ShowAll(); }
public TeacherAddAssignmentWindow(User user, TextViewList textviews) : base("Add Assignment") { this.user = user; this.textviews = textviews; SetSizeRequest(300, 300); Grid grid = new Grid(); Entry grad = new Entry(); grad.WidthRequest = 200; Label classLabel = new Label("Class:"); Entry name = new Entry(); name.WidthRequest = 200; Label nameLabel = new Label("File name:"); Label warningLabel = new Label(); Button uploadButton = new Button("Upload"); uploadButton.Clicked += delegate { List <MetaType> metaTypeList = new List <MetaType>(); // Packs the workspace into a single string for easy transfer foreach (Widget w in this.textviews) { if (w.GetType() == typeof(MovableCasCalcView)) { MetaType metaType = new MetaType(); MovableCasCalcView calcView = (MovableCasCalcView)w; metaType.type = typeof(MovableCasCalcView); metaType.metastring = calcView.calcview.input.Text; metaType.locked = calcView.textview.locked; metaTypeList.Add(metaType); } else if (w is MovableCasCalcMulitlineView) { MetaType metaType = new MetaType(); MovableCasCalcMulitlineView calcview = (MovableCasCalcMulitlineView)w; metaType.type = typeof(MovableCasCalcMulitlineView); metaType.metastring = calcview.calcview.SerializeCasTextView(); metaType.locked = calcview.textview.locked; metaTypeList.Add(metaType); } else if (w is MovableCasResult) { MetaType metaType = new MetaType(); MovableCasResult casres = (MovableCasResult)w; metaType.type = typeof(MovableCasResult); metaType.metastring = Export.Serialize(casres.casresult.facitContainer); metaType.locked = casres.textview.locked; metaTypeList.Add(metaType); } else if (w.GetType() == typeof(MovableCasTextView)) { MetaType metaType = new MetaType(); MovableCasTextView textView = (MovableCasTextView)w; metaType.type = typeof(MovableCasTextView); metaType.metastring = textView.textview.SerializeCasTextView(); metaType.locked = textView.textview.locked; metaTypeList.Add(metaType); } } // Sends the file, if there are anything to send if (metaTypeList.Count != 0 && !string.IsNullOrEmpty(name.Text) && !string.IsNullOrEmpty(grad.Text)) { string Assignment = Export.Serialize(metaTypeList); this.user.teacher.AddAssignment(Assignment, name.Text, grad.Text); MessageDialog ms = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Added assignment"); ms.Run(); ms.Destroy(); Destroy(); } else { warningLabel.Text = "Warning, upload invalid"; } }; Button cancelButton = new Button("Cancel"); cancelButton.Clicked += delegate { Destroy(); }; grid.Attach(nameLabel, 1, 1, 1, 1); grid.Attach(name, 2, 1, 1, 1); grid.Attach(classLabel, 1, 2, 1, 1); grid.Attach(grad, 2, 2, 1, 1); grid.Attach(warningLabel, 1, 3, 2, 1); grid.Attach(uploadButton, 2, 4, 1, 1); grid.Attach(cancelButton, 1, 4, 1, 1); Add(grid); ShowAll(); }