예제 #1
0
        private static void SelectOwnerImpl(FlatDecoratorViewModel flatDecorator)
        {
            Window window = Extensions.WindowExtensions.CreateEmptyVerticalWindow();

            window.MakeSticky();

            AborigenDecoratorViewModel selectedDecorator = null;

            void SelectView_OntAborigenSelected(AborigenDecoratorViewModel decorator)
            {
                selectedDecorator   = decorator;
                window.DialogResult = true;
            }

            var selectView = new SelectAborigenView();

            selectView.EventAborigenSelected += SelectView_OntAborigenSelected;
            window.Title = Resources.AborigensSelection;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.Owner   = Application.Current.MainWindow;
            window.Content = selectView;
            window.ShowDialog();

            selectView.EventAborigenSelected -= SelectView_OntAborigenSelected;
            if (selectedDecorator != null)
            {
                flatDecorator.SetOwner(selectedDecorator);
                CommandSave.RaiseCanExecuteChanged();
            }
        }
예제 #2
0
        private FlatViewModel FindFlat(int flatNumber)
        {
            FlatDecoratorViewModel targetFlat =
                allFloors
                .SelectMany(decorator => decorator.OriginaFloorViewModel.FlatsEnumerable)
                .FirstOrDefault(flatDecorator => flatDecorator.Flat.Number == flatNumber);

            return(targetFlat?.Flat);
        }
예제 #3
0
        private static void SaveImpl(FlatDecoratorViewModel flatDecorator)
        {
            bool saved = flatDecorator.Save();

            if (saved)
            {
                RelationsProvider.SaveOrUpdateOwnRelation(flatDecorator.OwnerDecorator.AborigenEditable.GetId(), flatDecorator.Flat.Number);
                flatDecorator.OnSaved();
            }
        }
예제 #4
0
 private static void ShowFlatIndicationsImpl(FlatDecoratorViewModel flat)
 {
     flat.Publish(new MessageShowFlatIndications(flat));
 }
예제 #5
0
 private void SimpleFlatView_OnEventShowOwnerDetails(FlatDecoratorViewModel flat)
 {
     this.Publish(new MessageShowAborigenDetails(flat.OwnerDecorator));
 }
예제 #6
0
 private void SimpleFlatView_OnEventShowFlatDetails(FlatDecoratorViewModel flat)
 {
     this.Publish(new MessageShowFlatDetails(flat));
 }
 public MessageShowFlatIndications(FlatDecoratorViewModel flatDecorator)
 {
     FlatDecorator = flatDecorator;
 }
예제 #8
0
 private static bool CanSave(FlatDecoratorViewModel flatDecorator)
 {
     return(flatDecorator != null);
 }