void RemoveImpl()
        {
            Context.Default.StopWords.Remove(_stopWordEntity);
            Context.Default.SaveChanges();

            GoBack.Execute(new { });
        }
Пример #2
0
 public override void OnNavigating(object parameter)
 {
     base.OnNavigating(parameter);
     if ((parameter != null) && (parameter is Guid))
     {
         Guid guid = (Guid)parameter;
         if (guid != Guid.Empty)
         {
             _dataService.GetImage(guid, new Action <FullImage, Exception>((image, ex) =>
             {
                 _image = image;
                 if (_image != null)
                 {
                     ImageData = _image.FullImageData;
                     ImageName = _image._imageName;
                     CanSave   = false;
                 }
             }));
         }
         else
         {
             _image = new FullImage {
                 _id = guid
             };
         }
     }
     else
     {
         GoBack.Execute(null);
     }
 }
        void Save()
        {
            _person.NominativeName       = NominativeName.Trim().ToLower();
            _person.NominativeSurname    = NominativeSurname.Trim().ToLower();
            _person.GenitiveName         = GenitiveName.Trim().ToLower();
            _person.GenitiveSurname      = GenitiveSurname.Trim().ToLower();
            _person.DativeName           = DativeName.Trim().ToLower();
            _person.DativeSurname        = DativeSurname.Trim().ToLower();
            _person.AccusativeName       = AccusativeName.Trim().ToLower();
            _person.AccusativeSurname    = AccusativeSurname.Trim().ToLower();
            _person.InstrumentalName     = InstrumentalName.Trim().ToLower();
            _person.InstrumentalSurname  = InstrumentalSurname.Trim().ToLower();
            _person.PrepositionalName    = PrepositionalName.Trim().ToLower();
            _person.PrepositionalSurname = PrepositionalSurname.Trim().ToLower();

            if (_isNew)
            {
                Context.Default.KnownPersons.Add(_person);
            }

            Tools.MergeKnownNameWithKnownPerson(_person);

            Context.Default.SaveChanges();

            GoBack.Execute(null);
        }
 private async void Playback_MediaFailed(object sender, EventArgs e)
 {
     await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Normal, async() =>
     {
         if (CurrentMedia is StreamMedia)
         {
             await Locator.MediaLibrary.RemoveStreamFromCollectionAndDatabase(CurrentMedia as StreamMedia);
         }
         GoBack.Execute(null);
     });
 }
Пример #5
0
 private async void Playback_MediaFailed()
 {
     await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, async() =>
     {
         if (Locator.PlaybackService.CurrentPlaybackMedia is StreamMedia)
         {
             await Locator.MediaLibrary.RemoveStreamFromCollectionAndDatabase(Locator.PlaybackService.CurrentPlaybackMedia as StreamMedia);
         }
         GoBack.Execute(null);
     });
 }
 private void EventsManager_ObjectChangedEvent(object sender, ObjectChangedEventArgs e)
 {
     if (e.ObjectChanged is Course && e.Type == ChangeType.Deleted)
     {
         if (e.ObjectChanged is Course && (e.ObjectChanged as Course).ID == SelectedCourse?.ID || SelectedCourse == null)
         {
             object o = new object();
             GoBack.Execute(o);
         }
     }
 }
 private async void MediaPlaybackViewModel_InternetConnectionChanged(object sender, Model.Events.InternetConnectionChangedEventArgs e)
 {
     if (!e.IsConnected && IsPlaying && CurrentMedia is StreamMedia)
     {
         await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Normal, async() =>
         {
             GoBack.Execute(null);
             var dialog = new MessageDialog(Strings.MediaCantBeRead.ToUpperFirstChar(), Strings.NoInternetConnection.ToUpperFirstChar());
             await dialog.ShowAsync();
         });
     }
 }
        void RemoveImpl()
        {
            if (_isNew)
            {
                return;
            }

            Context.Default.KnownPersons.Remove(_person);
            Context.Default.SaveChanges();

            GoBack.Execute(new { });
        }
        void AddNewImpl()
        {
            var stopWord = _stopWordEntity ?? new StopWord();

            stopWord.Pattern = StopWordText;

            if (stopWord.Id == 0)
            {
                Context.Default.StopWords.Add(stopWord);
            }

            Context.Default.SaveChanges();

            GoBack.Execute(new { });
        }
Пример #10
0
 private void EventsManager_ObjectChangedEvent(object sender, ObjectChangedEventArgs e)
 {
     if (e.Type == ChangeType.Deleted)
     {
         if (e.ObjectChanged is Group || e.ObjectChanged is Course || e.ObjectChanged is Module || e.ObjectChanged is Student)
         {
             LoadData(Person);
         }
         if (e.ObjectChanged is Person)
         {
             if (Person.ID == (e.ObjectChanged as Person).ID)
             {
                 object o = new object();
                 GoBack.Execute(o);
             }
         }
     }
 }
        /// <summary>
        /// Handle events when the popup window closes
        /// </summary>
        private void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Popup window is closed
            if (!popupWindow.IsOpen)
            {
                // Pop-up is closing, so detach PopupInfo.PropertyChanged and MapApplication.Current.SelectedLayerChanged events
                PopupInfo.PropertyChanged -= PopupInfo_PropertyChanged;
                MapApplication.Current.SelectedLayerChanged -= Current_SelectedLayerChanged;

                // If the pop-up is closing and the temporary layer still exists, remove it from the map.
                if (temporaryLayer != null)
                {
                    if (MapApplication.Current.SelectedLayer == temporaryLayer)
                    {
                        HideFeatureDataGrid();
                    }

                    if (map.Layers.Contains(temporaryLayer))
                    {
                        map.Layers.Remove(temporaryLayer);
                    }

                    temporaryLayer = null;
                }


                Grid infoWindowGrid = Utils.FindChildOfType <Grid>(popupWindow, 3);
                if (infoWindowGrid.Children.Contains(indicator))
                {
                    infoWindowGrid.Children.Remove(indicator); // Remove the busy indicator from the pop-up window
                }
                if (CloseNoRecordsView.CanExecute(popupWindow))
                {
                    CloseNoRecordsView.Execute(popupWindow);
                }

                if (GoBack.CanExecute(popupWindow))
                {
                    GoBack.Execute(popupWindow);
                }

                _popupItemChanged = false;
            }
        }