public Task ShowEditor(object resource, FileInfo info)
        {
            var editor = new UvMappingEditor {
                Source = (UvMapping)resource
            };

            return(new EditorWindowManager <UvMapping>(this, editor, editor.Source, info).ShowEditor());
        }
        public Task ShowEditor(FileInfo info, object resource)
        {
            var dialogBoxService = ServiceLocator.Get <IDialogBoxService>();
            var uvMappingEditor  = new UvMappingEditor {
                Source = (UvMapping)resource
            };

            bool assetChanged     = false;
            var  notifier         = new PropertyChangedEventHandler((sender, args) => assetChanged = assetChanged || !args.PropertyName.Contains(nameof(Segment.Editor)));
            var  completionSource = new TaskCompletionSource <object>();

            uvMappingEditor.Source.RecursivePropertyChanged += notifier;
            uvMappingEditor.Closing += (sender, args) =>
            {
                Keyboard.Focus(uvMappingEditor);
                var result = MessageBoxResult.None;

                if (assetChanged)
                {
                    result = dialogBoxService.ShowNativeDialog("Do you want to save the changes", "Warning", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                }

                switch (result)
                {
                case MessageBoxResult.Cancel:
                    args.Cancel = true;
                    break;

                case MessageBoxResult.Yes:
                    Task.Run(() => SaveToDisk(info, resource)).ContinueWith(_ => completionSource.SetResult(null));
                    break;

                case MessageBoxResult.No:
                    ReloadFromDisk(info, resource);
                    completionSource.SetResult(null);
                    break;
                }

                if (!args.Cancel)
                {
                    uvMappingEditor.Source.RecursivePropertyChanged -= notifier;
                }
            };

            dialogBoxService.ShowCustomDialog(uvMappingEditor);

            return(completionSource.Task);
        }