Example #1
0
 /// <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);
     }
 }
Example #2
0
        public async Task Insert_Button_And_Find_And_Delete_Test()
        {
            var client = new HistoryMapWebClient(user, pass);
            var record = new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5), new Point(5, 5),
                                                     "SomeType", new Dictionary <string, string>()
            {
                { "Key", "Value" }
            }, 50, 50, Guid.NewGuid().ToString());

            //create record
            var a = await client.CreateRecord(record);

            Assert.IsTrue(a.Success);

            //Find record
            var allRecords = await client.GetButtons();

            var inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNotNull(inserted);

            //Delete record
            var deleteResult = await client.Delete <GenericLabelForWorldMap>(record._id);

            Assert.IsTrue(deleteResult.Success);

            //Check deletion
            allRecords = await client.GetButtons();

            inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNull(inserted);
        }
Example #3
0
        /// <summary>
        /// This on click event should be passed to the world form in order to get the vals we need to work with
        /// </summary>
        public void ClickDelegate(object sender, EventArgs e)
        {
            MouseEventArgs click            = (MouseEventArgs)e; //Static cast the event args to get them to be the only type they ever will be
            var            actualClickPoint = viewForm.LocalDrawClass.CalculateUiToMap(click.X, click.Y);
            ButtonCreator  infoPanel        = new ButtonCreator(actualClickPoint, viewForm.LocalDrawClass.CurrentDate);
            var            result           = infoPanel.ShowDialog();

            if (result == DialogResult.OK)
            {
                LocalMongoGetter.AddButton(NewGenericLabelForWorldMap, viewForm.LocalDrawClass.CurrentDate);
                NewGenericLabelForWorldMap = null;
            }
        }
Example #4
0
        public async Task InsertandUpdate_Button_AD()
        {
            var client = new HistoryMapWebClient(user, pass);
            var record = new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5), new Point(5, 5),
                                                     "SomeType", new Dictionary <string, string>()
            {
                { "Key", "Value" }
            }, 50, 50, Guid.NewGuid().ToString());

            //create record
            var a = await client.CreateRecord(record);

            Assert.IsTrue(a.Success);

            //Find record
            var allRecords = await client.GetButtons();

            var inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNotNull(inserted);

            //Update record
            var newDate = new LocalDate(Era.Common, 1050, 05, 05);

            record.timeOf = newDate;
            var updateResult = await client.UpdateRecord(record);

            Assert.IsTrue(updateResult.Success);

            //Check update
            allRecords = await client.GetButtons();

            inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.AreEqual(newDate, inserted.timeOf);
        }