private void GenerateMp3_Completed(Object sender, RunWorkerCompletedEventArgs e) { WindowParams wndParams = null; if (e.Error != null) { Exception innerEx = null; String errMsg = String.Empty; innerEx = (e.Error.InnerException != null ? e.Error.InnerException : e.Error); errMsg = String.Format("Generated failed! Exception: {0}\n\n{1}", innerEx.Message, innerEx.StackTrace); MessageBox.Show(errMsg, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { WriteConfig(); MessageBoxResult dlgRet = MessageBoxResult.None; dlgRet = MessageBox.Show("Mp3 file generated!\nDo you want to open located folder?", "Information", MessageBoxButton.YesNo); if (MessageBoxResult.Yes == dlgRet) { wndParams = (WindowParams)e.Result; OpenDestDirAndSelectFile(wndParams.FinalMp3File); } } progBar.Visibility = Visibility.Hidden; gridWholeWnd.IsEnabled = true; }
private void WindowOwnerRoutine(object state) { WindowParams wp = (WindowParams)state; base.ConstructDefaultWindow(wp.Width, wp.Height, wp.WindowState); wp.ResetEvent.Set(); double previousPollTimeMs = 0; Stopwatch sw = new Stopwatch(); sw.Start(); while (NativeWindow.Exists) { if (_shouldClose) { NativeWindow.Close(); } double currentTick = sw.ElapsedTicks; double currentTimeMs = sw.ElapsedTicks * (1000.0 / Stopwatch.Frequency); if (LimitPollRate && currentTimeMs - previousPollTimeMs < PollIntervalInMs) { Thread.Sleep(0); } else { previousPollTimeMs = currentTimeMs; NativeWindow.CursorVisible = _isCursorVisible; NativeWindow.ProcessEvents(); } } }
public Sdl2Window(IntPtr windowHandle, bool threadedProcessing) { _threadedProcessing = threadedProcessing; if (threadedProcessing) { using (ManualResetEvent mre = new ManualResetEvent(false)) { WindowParams wp = new WindowParams() { WindowHandle = windowHandle, WindowFlags = 0, ResetEvent = mre }; Task.Factory.StartNew(WindowOwnerRoutine, wp, TaskCreationOptions.LongRunning); mre.WaitOne(); } } else { //初始化事件子系统和Vedio子系统后就sdlwindows就可以正常工作了,还有其它很多子系统请自行查看定义 //SDL是一个跨平台的GamePlatform,这里暂时只使用其事件处理,达到通用的目的,类似GLTW库的功能 //veldrid暴露的sdl函数和接口并不完全,可以考虑使用SDLSharp的接口,这里暂不深究。 Sdl2Native.SDL_Init(SDLInitFlags.EVENTS | SDLInitFlags.Video); _window = SDL_CreateWindowFrom(windowHandle); //给出一定的错误提示 if (_window == IntPtr.Zero) { throw new Exception("SDL_CreateWindowFrom()", new Exception(UTF8_ToManaged((IntPtr)SDL_GetError(), false))); } WindowID = SDL_GetWindowID(_window); Sdl2EventProcessor.RegisterWindow(this); PostWindowCreated(0); } }
public override void OnShowComplete(WindowParams param_ = null) { base.OnShowComplete(param_); AuthState startState; if (windowsParameters != null) { AuthWindowParams authParams = (AuthWindowParams)windowsParameters; startState = authParams.startState; _authData = authParams.authData; } else { startState = AuthState.LOGIN; _authData = new AuthData(); } loginState.OnSignUpClick += (AuthData authData_) => { SwitchState(AuthState.SIGNUP, authData_); }; signupState.OnLogInClick += (AuthData authData_) => { SwitchState(AuthState.LOGIN, authData_); }; _stateSwitcher = new BaseStateMachine <AuthState, AuthWindowState> (); _stateSwitcher.Add(AuthState.LOGIN, loginState); _stateSwitcher.Add(AuthState.SIGNUP, signupState); SwitchState(startState, _authData); }
public Sdl2Window(string title, int x, int y, int width, int height, SDL_WindowFlags flags, bool threadedProcessing) { _threadedProcessing = threadedProcessing; if (threadedProcessing) { using (ManualResetEvent mre = new ManualResetEvent(false)) { WindowParams wp = new WindowParams() { Title = title, X = x, Y = y, Width = width, Height = height, WindowFlags = flags, ResetEvent = mre }; Task.Factory.StartNew(WindowOwnerRoutine, wp, TaskCreationOptions.LongRunning); mre.WaitOne(); } } else { _window = SDL_CreateWindow(title, x, y, width, height, flags); WindowID = SDL_GetWindowID(_window); Sdl2EventProcessor.RegisterWindow(this); PostWindowCreated(flags); } }
public Sdl2Window(IntPtr windowHandle, bool threadedProcessing) { _threadedProcessing = threadedProcessing; if (threadedProcessing) { using (ManualResetEvent mre = new ManualResetEvent(false)) { WindowParams wp = new WindowParams() { WindowHandle = windowHandle, WindowFlags = 0, ResetEvent = mre }; Task.Factory.StartNew(WindowOwnerRoutine, wp, TaskCreationOptions.LongRunning); mre.WaitOne(); } } else { _window = SDL_CreateWindowFrom(windowHandle); WindowID = SDL_GetWindowID(_window); Sdl2EventProcessor.RegisterWindow(this); PostWindowCreated(0); } }
private Boolean ValidateInput(WindowParams wndParams) { if (File.Exists(wndParams.FinalMp3File)) { MessageBoxResult msgRet = MessageBox.Show("File is existing. Do you want to delete existing file?", "Information", MessageBoxButton.YesNo, MessageBoxImage.Information); if (MessageBoxResult.Yes == msgRet) { File.Delete(wndParams.FinalMp3File); } else { return(false); } } if (!String.IsNullOrEmpty(wndParams.LameFilePath) && !File.Exists(wndParams.LameFilePath)) { MessageBox.Show("Cannot find lame.exe under given path.", "Error"); return(false); } if (wndParams.WordArray.Length == 0) { MessageBox.Show("You must provide at lease 1 word.", "Error"); return(false); } return(true); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List <DummyCmObject> mergeCandidates, string guiControl, string helpTopic) { CheckDisposed(); Debug.Assert(cache != null); m_mediator = mediator; m_cache = cache; m_mainObj = mainObj; m_tsf = cache.TsStrFactory; m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory; m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.WritingSystemFactory.UserWs; InitBrowseView(guiControl, mergeCandidates); Text = wp.m_title; label2.Text = wp.m_label; m_helpTopic = helpTopic; if (m_helpTopic != null && m_helpTopicProvider != null) // m_helpTopicProvider could be null for testing { helpProvider = new HelpProvider(); helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic)); helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); } MoveWindowToPreviousPosition(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Launch the Find Entry dialog, and if one is created or selected return it. /// </summary> /// <param name="cache">The cache.</param> /// <param name="mediator">The mediator.</param> /// <param name="propertyTable"></param> /// <param name="tssForm">The TSS form.</param> /// <param name="owner">The owner.</param> /// <returns>The HVO of the selected or created entry</returns> /// ------------------------------------------------------------------------------------ internal static ILexEntry ShowFindEntryDialog(LcmCache cache, Mediator mediator, PropertyTable propertyTable, ITsString tssForm, IWin32Window owner) { using (EntryGoDlg entryGoDlg = new EntryGoDlg()) { // Temporarily set TopMost to true so it will launch above any calling app (e.g. Paratext) // but reset after activated. SetCurrentModalForm(entryGoDlg); var wp = new WindowParams { m_btnText = FdoUiStrings.ksShow, m_title = FdoUiStrings.ksFindInDictionary, m_label = FdoUiStrings.ksFind_ }; if (owner == null) { entryGoDlg.StartPosition = FormStartPosition.CenterScreen; } entryGoDlg.Owner = owner as Form; entryGoDlg.SetDlgInfo(cache, wp, mediator, propertyTable, tssForm); entryGoDlg.SetHelpTopic("khtpFindInDictionary"); if (entryGoDlg.ShowDialog() == DialogResult.OK) { var entry = entryGoDlg.SelectedObject as ILexEntry; Debug.Assert(entry != null); return(entry); } } return(null); }
public override void OnShowComplete(WindowParams param = null) { base.OnShowComplete(param); GlobalEvents.OnLoadingProgress.Subscribe(OnLoadProgressEvent); loadingStatusText.text = "please wait..."; }
public override void OnShowComplete(WindowParams param_ = null) { base.OnShowComplete(param_); startButton.onClick.AddListener(OnStartButton); quitButton.onClick.AddListener(OnQuitButton); hintText.enabled = SystemInfo.deviceType == DeviceType.Desktop; }
public override void OnShowComplete(WindowParams param_ = null) { base.OnShowComplete(param_); quitButton.onClick.AddListener(OnQuitButton); restartButton.onClick.AddListener(OnRestartButton); menuButton.onClick.AddListener(OnMenuButton); }
public Window( Transform parent, Material material, WindowParams _winParams ) { winParams = _winParams; CreateWindow(parent, material); }
private WindowParams GetWindowParams() { WindowParams wndParams = new WindowParams(); wndParams.FinalMp3File = txtMp3File.Text; wndParams.LameFilePath = txtLameExe.Text; wndParams.WordArray = txtWords.Text.Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); return(wndParams); }
private void btnGenerate_Click(object sender, RoutedEventArgs e) { WindowParams wndParams = GetWindowParams(); if (ValidateInput(wndParams)) { gridWholeWnd.IsEnabled = false; m_bgWorker.RunWorkerAsync(wndParams); } }
public BaseWindow ShowWindow(string windowName_, WindowParams param_ = null) { HideAllWindows(); GameObject windowGo = LoadPrefab(windowName_); BaseWindow newWindow = InstantiateWindow(windowGo); newWindow.OnShowComplete(param_); _shownWindows.Add(newWindow); return(newWindow); }
public override void OnShowComplete(WindowParams param_ = null) { base.OnShowComplete(param_); EventManager.Get <LoadProgressEvent> ().Subscribe(OnLoadProgressEvent); EventManager.Get <DataInitCompleteEvent> ().Subscribe(OnLoadComplete); loadingStatusText.text = "please wait..."; startButton.onClick.AddListener(OnStartButton); startButton.gameObject.SetActive(false); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO); LexRefType.MappingTypes type = (LexRefType.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; switch (type) { case LexRefType.MappingTypes.kmtSensePair: case LexRefType.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryPair: case LexRefType.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSensePair: case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; break; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); //on creating Pair Lexical Relation have an Add button and Add in the title bar if (TargetHvo == 0) { wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.AnalysisDefaultWritingSystem); wp.m_btnText = LexEdStrings.ks_Add; } else //Otherwise we are Replacing the item { wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry); wp.m_btnText = LexEdStrings.ks_Replace; } wp.m_label = LexEdStrings.ksFind_; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { TargetHvo = dlg.SelectedID; } dlg.Dispose(); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { var lrt = (ILexRefType)m_obj.Owner; var type = (LexRefTypeTags.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; string sTitle = string.Empty; try { switch (type) { case LexRefTypeTags.MappingTypes.kmtSenseCollection: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryCollection: dlg = new EntryGoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseCollection: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = sTitle, m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK && dlg.SelectedObject != null) { if (!((ILexReference)m_obj).TargetsRS.Contains(dlg.SelectedObject)) { AddItem(dlg.SelectedObject); } } } finally { if (dlg != null) { dlg.Dispose(); } } }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List <DummyCmObject> mergeCandidates, string guiControl, string helpTopic) { CheckDisposed(); Debug.Assert(cache != null); m_mediator = mediator; m_cache = cache; m_mainObj = mainObj; m_tsf = TsStrFactoryClass.Create(); m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem; InitBrowseView(guiControl, mergeCandidates); // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("mergeDlgLocation"); // JohnT: this dialog can't be resized. So it doesn't make sense to // remember a size. If we do, we need to override OnLoad (as in SimpleListChooser) // to prevent the dialog growing every time at 120 dpi. But such an override // makes it too small to show all the controls at the default size. // It's better just to use the default size until it's resizeable for some reason. //m_mediator.PropertyTable.GetValue("msaCreatorDlgSize"); // And when I do this, it works the first time, but later times the window is // too small and doesn't show all the controls. Give up on smart location for now. //object szWnd = this.Size; object szWnd = null; // suppresses the smart location stuff. if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } Text = wp.m_title; label2.Text = wp.m_label; m_helpTopic = helpTopic; if (m_helpTopic != null && FwApp.App != null) // FwApp.App could be null for testing { helpProvider = new System.Windows.Forms.HelpProvider(); helpProvider.HelpNamespace = FwApp.App.HelpFile; helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0)); helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); } }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private ICmObject GetRootObject(ILexRefType lrt) { ICmObject first = null; EntryGoDlg dlg = null; try { switch ((LexRefTypeTags.MappingTypes)lrt.MappingType) { case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtEntryTree: dlg = new EntryGoDlg(); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; default: Debug.Assert(lrt.MappingType == (int)LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefTypeTags.MappingTypes.kmtSenseTree); return(null); } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.ReverseName.BestAnalysisAlternative.Text), m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { first = dlg.SelectedObject; } return(first); } finally { if (dlg != null) { dlg.Dispose(); } } }
protected override void HandleChooser() { using (var dlg = new LinkEntryOrSenseDlg()) { var wp = new WindowParams { m_title = LexEdStrings.ksIdentifySense, m_btnText = LexEdStrings.ksSetReversal }; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SelectSensesOnly = true; if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { AddItem(dlg.SelectedObject); } } }
private void GenerateMp3_InBGWorker(Object sender, DoWorkEventArgs e) { BackgroundWorker bgWorker = (BackgroundWorker)sender; WindowParams wndParams = (WindowParams)e.Argument; Exception innerEx = null; if (GenerateMp3(wndParams, bgWorker, out innerEx)) { e.Result = wndParams; } else { throw new Exception("Generate mp3 failed", innerEx); } }
static void Main(string[] args) { WindowParams p = new WindowParams(false, "Demo") { Resizable = false, Width = 1920, Height = 1080 }; Application.Init(p); InitializeGame(); Application.Run(); System.GC.Collect(); System.Console.ReadKey(); }
protected override void HandleChooser() { using (var dlg = new RecordGoDlg()) { var wp = new WindowParams { m_title = LexEdStrings.ksIdentifyRecord, m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, m_mediator, m_propertyTable); dlg.SetHelpTopic(Slice.GetChooserHelpTopicID()); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { AddItem(dlg.SelectedObject); } } }
public Sdl2Window(string title, int x, int y, int width, int height, SDL_WindowFlags flags, bool threadedProcessing) { _threadedProcessing = threadedProcessing; wp = new WindowParams() { Title = title, X = x, Y = y, Width = width, Height = height, WindowFlags = flags, //ResetEvent = mre }; }
protected override void ConstructDefaultWindow(int width, int height, WindowState state) { using (ManualResetEvent mre = new ManualResetEvent(false)) { WindowParams wp = new WindowParams() { Width = width, Height = height, WindowState = state, ResetEvent = mre }; Task.Factory.StartNew(WindowOwnerRoutine, wp, TaskCreationOptions.LongRunning); mre.WaitOne(); } }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries or senses. /// </summary> protected override void HandleChooser() { using (LinkEntryOrSenseDlg dlg = new LinkEntryOrSenseDlg()) { WindowParams wp = new WindowParams(); wp.m_title = LexEdStrings.ksIdentifySense; wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ksSetReversal; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SelectSensesOnly = true; if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { AddItem(dlg.SelectedID); } } }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private int GetRootObjectHvo(ILexRefType lrt) { int hvoFirst = 0; BaseEntryGoDlg dlg = null; switch ((LexRefType.MappingTypes)lrt.MappingType) { case LexRefType.MappingTypes.kmtSenseAsymmetricPair: case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryAsymmetricPair: case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; default: Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree); return(0); } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); //wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, // lrt.Name.AnalysisDefaultWritingSystem); wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.ReverseName.BestAnalysisAlternative.Text); wp.m_label = LexEdStrings.ksFind_; //wp.m_btnText = LexEdStrings.ks_Link; wp.m_btnText = LexEdStrings.ks_Add; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { hvoFirst = dlg.SelectedID; } dlg.Dispose(); return(hvoFirst); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = (ILexRefType)m_obj.Owner; int type = lrt.MappingType; BaseGoDlg dlg = null; try { switch ((LexRefTypeTags.MappingTypes)type) { case LexRefTypeTags.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefTypeTags.MappingTypes.kmtEntryTree: dlg = new EntryGoDlg(); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = String.Format(LexEdStrings.ksReplaceXEntry), m_btnText = LexEdStrings.ks_Replace }; //This method is only called when we are Replacing the //tree root of a Whole/Part lexical relation dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { if (dlg.SelectedObject != null) { AddItem(dlg.SelectedObject); } } } finally { if (dlg != null) { dlg.Dispose(); } } }