/// <summary> /// This should populate the localform with the one item we need to actually display /// </summary> private void ItemsList_SelectedIndexChanged(object sender, EventArgs e) { if (ItemsList.SelectedIndex == -1) { return; } if (ItemsList.SelectedIndex < _unverifiedBordersList.Count)//If the item is in the borders list { BorderStorage = _unverifiedBordersList[ItemsList.SelectedIndex]; viewForm.LocalDrawClass.CurrentDate = BorderStorage.TimeOf; var localDate = viewForm.LocalDrawClass.CurrentDate; viewForm.CurrentDate.Text = localDate.ToString() + @" " + localDate.Era; ButtonName = null; CreateFormInstance(false, false); } else//if the items in the other list { int fieldToGet = ItemsList.SelectedIndex - _unverifiedBordersList.Count; ButtonName = _unverifiedButtonsList[fieldToGet]; viewForm.LocalDrawClass.CurrentDate = ButtonName.timeOf; var localDate = viewForm.LocalDrawClass.CurrentDate; viewForm.CurrentDate.Text = localDate.ToString() + @" " + localDate.Era; BorderStorage = null; CreateFormInstance(false, false); } }
/// <summary> /// This saves the border to the db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CompleteBtn_Click(object sender, EventArgs e) { using (var form = new DateSelectionModal(viewForm.LocalDrawClass.CurrentDate)) { var dialogResult = form.ShowDialog(); if (dialogResult == DialogResult.OK) { if (viewForm.LocalDrawClass.CurrentDate > form.ReturnTime) { MessageBox.Show(@"You're trying to create a start time before an end time"); return; } else { LocalBorderStorageClass.ValidTill = form.ReturnTime; } } else { return; } } DeleteIndexBtn.Visible = false; CompleteBtn.Visible = false; ViewCompleteBtn.Visible = false; IndexList.Visible = false; BorderDrawingBtn.Checked = false; CreateFormInstance(true); PolygonCreator.Drawing = false; viewForm.WorldMap.Click -= BorderDrawingClickDelegate; viewForm.LocalDrawClass.MoveForm = false; LocalBorderStorageClass.TimeOf = viewForm.LocalDrawClass.CurrentDate; LocalBorderStorageClass._id = Guid.NewGuid().ToString(); LocalBorderStorageClass.Verified = false; LocalMongoGetter.SaveBorder(LocalBorderStorageClass); LocalBorderStorageClass = null; }