示例#1
0
        protected void AddObjectToUi(object objectToDisplay, Action nextAction = null, string nextActionLabel = null, Action cancelAction = null, Action backAction = null)
        {
            var vm = new ObjectDisplayViewModel(objectToDisplay, FormController.CreateForObject(objectToDisplay, ApplicationController, null)
                                                , nextAction: nextAction, nextActionLabel: nextActionLabel, cancelAction: cancelAction, backAction: backAction);

            Controller.LoadToUi(vm);
        }
 public void SetDetailObject(object detailObject)
 {
     ApplicationController.DoOnAsyncThread(() =>
     {
         DetailObjectViewModel = new ObjectDisplayViewModel(detailObject, FormController.CreateForObject(detailObject, ApplicationController, null));
         OnPropertyChanged(nameof(DetailObjectViewModel));
     });
 }
        protected override void CompleteDialogExtention()
        {
            if (SaveSettings)
            {
                var isMovingFolder = VisualStudioService.GetSolutionFolder(VisualStudioService.ItemFolderName) == null &&
                                     VisualStudioService.GetItemText("solution.xrmconnection", "SolutionItems") != null;
                base.CompleteDialogExtention();
                //set the active connection to the connection selected as active
                if (SettingsObject.Connections != null)
                {
                    var activeConnections = SettingsObject.Connections.Where(c => c.Active);
                    if (activeConnections.Any())
                    {
                        var activeConnection = activeConnections.First();
                        var settingsManager  = ApplicationController.ResolveType(typeof(ISettingsManager)) as ISettingsManager;
                        if (settingsManager == null)
                        {
                            throw new NullReferenceException("settingsManager");
                        }
                        settingsManager.SaveSettingsObject(activeConnection);

                        XrmConnectionModule.RefreshXrmServices(activeConnection, ApplicationController, xrmRecordService: (RefreshActiveServiceConnection ? XrmRecordService : null));
                        LookupService = (XrmRecordService)ApplicationController.ResolveType(typeof(XrmRecordService));
                    }
                }
                if (isMovingFolder)
                {
                    var openIt = ApplicationController.UserConfirmation("This Visual Studio extention is changing the way saved settings are stored. Click yes to open a window outlining the changes, and detailing code changes required if you use instances of the Xrm Solution Template");
                    if (openIt)
                    {
                        var blah             = new SettingsFolderMoving();
                        var displaySomething = new ObjectDisplayViewModel(blah, FormController.CreateForObject(blah, ApplicationController, null));
                        ApplicationController.NavigateTo(displaySomething);
                    }
                }
            }
            CompletionMessage = "Settings Updated";
        }
示例#4
0
        protected override void LoadDialogExtention()
        {
            var objectDisplayViewModel = new ObjectDisplayViewModel(About, FormController.CreateForObject(About, ApplicationController, null));

            Controller.LoadToUi(objectDisplayViewModel);
        }
 public void ClearDetailObject()
 {
     DetailObjectViewModel = null;
     OnPropertyChanged(nameof(DetailObjectViewModel));
 }