protected override void OnApply(PageApplyEventArgs e)
        {
            page.SetInfoLabelText("");

            // show welcome view if user clears the URL
            if ("".Equals(OctaneConfiguration.Url))
            {
                if (OctaneMyItemsViewModel.Instance != null)
                {
                    OctaneMyItemsViewModel.Instance.Mode = MainWindowMode.FirstTime;
                }
                return;
            }

            var result = Run(async() => { return(await TestConnection()); }).Result;

            if (!result.Equals(ConnectionSuccessful))
            {
                e.ApplyBehavior = ApplyKind.CancelNoNavigate;
            }
            else
            {
                setOldCredentials();

                // reset and thus require a new octane service obj
                Run(async() => { return(await OctaneServices.Reset()); }).Wait();

                // create a new service object
                OctaneServices.Create(OctaneConfiguration.Url,
                                      OctaneConfiguration.SharedSpaceId,
                                      OctaneConfiguration.WorkSpaceId);


                // close all opened details windows so that we don't have details windows
                // for entities from different workspaces
                PluginWindowManager.CloseAllDetailsWindows();

                // disable the active item toolbar because we don't know yet
                // whether we can connect with the new Octane credentials
                MainWindowCommand.Instance.DisableActiveItemToolbar();

                openToolWindow();

                // After settings are applied we notify the main ViewModel to allow it to refresh.
                if (OctaneMyItemsViewModel.Instance != null)
                {
                    InitialisePluginComponents();
                }

                if (ssologin)
                {
                    clearUserPassTextBoxes();
                }

                base.OnApply(e);
            }

            page.SetInfoLabelText(result);
        }
示例#2
0
 public Client(QueryCore query, string querySelection, bool compileOnly, QueryCompilationEventArgs lastCompilation, Func <Client, Server> serverGenerator, PluginWindowManager pluginWinManager)
 {
     this._query            = query;
     this._partialSource    = !string.IsNullOrEmpty(querySelection);
     this._source           = this._partialSource ? querySelection : this._query.Source;
     this._compileOnly      = compileOnly;
     this._lastCompilation  = lastCompilation;
     this._serverGenerator  = serverGenerator;
     this._pluginWinManager = pluginWinManager;
 }
示例#3
0
        private void SearchInternal(object parameter)
        {
            if (string.IsNullOrEmpty(SearchFilter) || string.IsNullOrEmpty(SearchFilter.Trim()))
            {
                return;
            }

            SearchFilter = SearchFilter.Trim();

            WorkspaceSessionPersistanceManager.UpdateHistory(SearchFilter);
            NotifyPropertyChanged("SearchHistory");

            PluginWindowManager.ShowSearchWindow(MainWindow.PluginPackage, SearchFilter);
        }
示例#4
0
        private static void OpenActiveItemInDetailsWindowCallback(object caller, EventArgs args)
        {
            try
            {
                var command = caller as OleMenuCommand;
                if (command == null)
                {
                    return;
                }

                var activeEntity = WorkspaceSessionPersistanceManager.GetActiveEntity();
                if (activeEntity == null)
                {
                    return;
                }

                PluginWindowManager.ShowDetailsWindow(MainWindow.PluginPackage, activeEntity);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to open details window for active item.\n\n" + "Failed with message: " + ex.Message,
                                ToolWindowHelper.AppName, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }