protected void HelpRequestedEventHandler(object sender, HelpRequestedEventArgs e) { if (_helpView == null) { if (string.IsNullOrEmpty(e.HelpBaseUri)) { e.Cancel = true; } else { _helpView = WorkItem.SmartParts.AddNew <ExplorerView>(); SmartPartInfo info = new SmartPartInfo(); info.Title = string.Format(StringResources.Application_Help_Title, Id); Uri helpUri = new Uri(new Uri(e.HelpBaseUri), Id + "/default.htm"); _helpView.SetUrl(info.Title, helpUri.AbsoluteUri); ShellInteractionService.Show(_helpView, info); } } else { ShellInteractionService.Show(_helpView); } }
private void HelpRequestedEventHandler(object sender, HelpRequestedEventArgs e) { if (string.IsNullOrEmpty(omsSessionContext.HelpUrl)) { e.Cancel = true; } else { Imi.SupplyChain.UX.Views.IExplorerView _helpView1 = WorkItem.SmartParts.AddNew <Imi.SupplyChain.UX.Views.ExplorerView>(); SmartPartInfo _helpInfo1 = new SmartPartInfo(); _helpInfo1.Title = Resources.HelpTabTitle; Uri helpUri = new Uri(omsSessionContext.HelpUrl); _helpView1.SetUrl(_helpInfo1.Title, helpUri.AbsoluteUri); ShellInteractionService.Show(_helpView1, _helpInfo1); } }
private void StartWebView(string programName, string programDescription, string programArgument) { string oneTimePassword = omsWebServiceWrapper.GetAWSOneTimePassword(omsSessionContext.OMSLogicalUserId); IWebView webView = WorkItem.SmartParts.AddNew <WebView>(); webView.menuId = programName; webView.menuDescription = programDescription; webView.oneTimePassword = oneTimePassword; webView.logicalUser = omsSessionContext.OMSLogicalUserId; webView.loginId = omsSessionContext.DomainUser; SmartPartInfo webSmartPartInfo = new SmartPartInfo(); webSmartPartInfo.Title = programName; webSmartPartInfo.Description = programDescription; ShellInteractionService.Show(webView, webSmartPartInfo); }
private void OpenTrimWindowHandler(object sender, dvEventArgs e) { // backend has created a new UserControl, show it as a new tab or new window or ... inUC TrimControl = e.Content; IDialogView OmsControl = WorkItem.SmartParts.AddNew <DialogView>(); OmsControl.Id = programStartSequence++; //Save the containing module for the OmsControl to use when it is closing. [Dashboard compliance] object containingModule = null; if (inUCContainingModuleDic.ContainsKey((inUC)sender)) { containingModule = inUCContainingModuleDic[(inUC)sender]; inUCContainingModuleDic.Remove((inUC)sender); } //System.Diagnostics.Debug.WriteLine("Opening new trim Dialog: " + OmsControl.Id); OmsControl.Show(TrimControl); SmartPartInfo spInfo = null; switch (e.Type) { case dvWinType.Main: ShellInteractionService.Show(OmsControl); OpenTabs.Add(OmsControl); break; case dvWinType.Modal: // currently not used! break; case dvWinType.Float: // currently not used! break; } TrimControl.evCloseWin += (s, args) => { // backend confirms it is OK to close a program OmsControl.OKToClose(); //System.Diagnostics.Debug.WriteLine("About to close Dialog " + OmsControl.Id); if (OmsControl.ParentProgram != null) { IDialogView parent = OmsControl.ParentProgram; parent.RemoveChildProgram(OmsControl); OmsControl.ParentProgram = null; } switch (e.Type) { case dvWinType.Main: //Check containing module and use it´s ShellInteractionService to close the OmsControl. [Dashboard compliance] if (containingModule != null) { if (containingModule.GetType().GetProperty("ShellInteractionService") != null) { ((IShellInteractionService)containingModule.GetType().GetProperty("ShellInteractionService").GetValue(containingModule, null)).Close(OmsControl); } } else { ShellInteractionService.Close(OmsControl); } WorkItem.SmartParts.Remove(OmsControl); OpenTabs.Remove(OmsControl); if (OpenTabs.Count == 0 && isWindowCloseRequested) { // user has requested to close the window and no open programs remain Application.Current.MainWindow.Close(); } break; case dvWinType.Modal: // currently not used break; case dvWinType.Float: // currently not used break; } }; TrimControl.evTitleWin += (s, args) => { // set title and description (as tooltip on tab) string programInfo = (string)((FrameworkElement)TrimControl).Tag; char[] c = { ' ' }; string[] programInfoSplit = programInfo.Split(c); string title = programInfoSplit[0]; int titleLength = title.Length; if (OmsControl.ParentProgram != null) { string parentTitle = OmsControl.ParentProgram.ProgramName; title = parentTitle + " > " + title; } OmsControl.ProgramName = title; string description = null; if (programInfo.Length > titleLength) { description = programInfo.Substring(titleLength + 1).Trim(); OmsControl.ProgramDescription = description; } if (startParametersDictionary.ContainsKey(title)) { string startParams = startParametersDictionary[title]; OmsControl.StartParameters = startParams; startParametersDictionary.Remove(title); } //System.Diagnostics.Debug.WriteLine("Setting title on Dialog " + OmsControl.Id + " to " + title); switch (e.Type) { case dvWinType.Main: spInfo = new SmartPartInfo(); spInfo.Title = title; spInfo.Description = description; ShellInteractionService.Show(OmsControl, spInfo); break; case dvWinType.Float: // currently not used break; } }; if (workbenchParentView != null) { // backend is about to start a new sub program to a workbench workbenchParentView.AddChildProgram(OmsControl); OmsControl.ParentProgram = workbenchParentView; workbenchParentView = null; } TrimControl.evSendString += (s, args) => { // event received when starting and stopping workbench programs // or when the actions menu is to be updated string receivedStr = (string)((FrameworkElement)TrimControl).Tag; receivedStr = System.Web.HttpUtility.HtmlDecode(receivedStr); if (receivedStr.StartsWith("startProgram")) { OmsControl.IsWorkbenchParent = true; workbenchParentView = OmsControl; dvStart TrimStartClient = new dvStart(); TrimStartClient.evCreate += new EventHandler <dvEventArgs>(InitializeWorkbenchWindowHandler); try { string startWorkbenchProgXML = createStartWorkbenchProgramXml(receivedStr); TrimStartClient.newWindow(startWorkbenchProgXML); } catch (SecurityTokenExpiredException ex) { } } else if (receivedStr.StartsWith("stopProgram")) { foreach (IDialogView childProgram in OmsControl.GetChildPrograms()) { object childObject = childProgram.TrimControl; if (childObject is inUC) { inUC childControl = childObject as inUC; childControl.requestClose(); } } } else if (receivedStr.StartsWith("actions:")) { OmsControl.ShowActions(receivedStr.Substring(8)); } else if (receivedStr.StartsWith("savesearch:")) { OmsControl.SaveSeach(receivedStr.Substring(11)); } else if (receivedStr.StartsWith("savedashboard:")) { OmsControl.SaveInDashboard(receivedStr.Substring(14)); } }; }