示例#1
0
        //public RelayCommand AddMarkFromDeviceCommand
        //{
        //    get
        //    {
        //        return addMarkFromDeviceCommand ??
        //           (addMarkFromDeviceCommand = new RelayCommand((o) =>
        //           {
        //               AddMarkFromDeviceCommandMethod();
        //           }
        //           ));
        //    }
        //}

        public void AddMarkCommandMethod()
        {
            Models.Mark mark = new Models.Mark();
            mark.MarkNumber = CurrnetMarks.Count > 0 ? CurrnetMarks.Last().MarkNumber + 1 : 1;

            ViewModels.AddMarkViewModel addMarkViewModel = new AddMarkViewModel(mark);
            addMarkViewModel.CurrentRoute = CurrentRoute;
            Views.AddMarkView addMarkView = new Views.AddMarkView(addMarkViewModel);
            MakeLogEntry(8, null, null, "open AddMark. Start adding mark");
            if ((bool)addMarkView.ShowDialog())
            {
                Models.Mark mark_to_base = Models.Mark.GetCopyOfMark(addMarkViewModel.CurrentMark);
                AddEntry <Models.Mark>(mark_to_base);
                CurrnetMarks.Add(mark_to_base);
                Models.Map map = new Models.Map()
                {
                    MarkId        = mark_to_base.Id,
                    CoordX        = 0,
                    CoordY        = 0,
                    DefaultHeight = 0,
                    DefaultWidth  = 0
                };
                AddEntry <Models.Map>(map);
                UpdateMapVisual();
            }
            else
            {
                MakeLogEntry(8, null, null, "open AddMark. Cancel adding mark");
            }
        }
示例#2
0
 public void EditMarkCommandMethod(Models.Mark SelectedItem)
 {
     if (SelectedItem == null || (CurrentUser.UserRoleId != 1 && CurrentUser.UserRoleId != 2))
     {
         return;
     }
     Models.Mark mark_to_view = Models.Mark.GetCopyOfMark(SelectedItem);
     ViewModels.AddMarkViewModel addMarkViewModel = new AddMarkViewModel(mark_to_view);
     addMarkViewModel.CurrentRoute = CurrentRoute;
     Views.AddMarkView addMarkView = new Views.AddMarkView(addMarkViewModel);
     addMarkView.Owner = CurrentMarksView;
     MakeLogEntry(8, null, null, "open AddMark. Start editing mark");
     if ((bool)addMarkView.ShowDialog())
     {
         Models.Mark mark_to_base = Models.Mark.GetCopyOfMark(addMarkViewModel.CurrentMark);
         EditEntry <Models.Mark>(mark_to_base);
         UpdateMapVisual();
     }
     else
     {
         MakeLogEntry(8, null, null, "open AddMark. Cancel editing mark");
     }
 }