public void SetAnimation(XAnimation animation) { keyframe_activeTime = 0; keyframe_startTime = 0; active_xAnim = animation; active_keyframe = active_xAnim.frames[0]; }
UIElement _configureNavigation(XFrame rootXFrame, Type rootPageType, bool isRoot) { Frame rootFrame = null; if (isRoot) { rootFrame = Window.Current.Content as Frame; } if (rootFrame == null) { rootFrame = new Frame(); } if (isRoot) { Window.Current.Content = rootFrame; } FrameNavigator = new XUWPFrameNavigator(_scope, rootXFrame, rootFrame, _viewResolver, rootPageType); // Ensure the current window is active if (isRoot) { Window.Current.Activate(); } SystemNavigationManager.GetForCurrentView().BackRequested += XUWPFrameManager_BackRequested; ; return rootFrame; }
/// <summary> /// Adds the specified x. /// </summary> /// <param name="X">The x.</param> /// <param name="Y">The y.</param> public void Add(List <float> X, float Y) { XFrame.Add(X); YFrame.Add(new List <float> { Y }); }
public static XFrame Create() { XFrame asset = ScriptableObject.CreateInstance <XFrame>(); if (!AssetDatabase.IsValidFolder("Assets/Resources")) { AssetDatabase.CreateFolder("Assets", "Resources"); } if (!AssetDatabase.IsValidFolder("Assets/Resources/Data")) { AssetDatabase.CreateFolder("Assets/Resources", "Data"); } if (!AssetDatabase.IsValidFolder("Assets/Resources/Data/XFrameData")) { AssetDatabase.CreateFolder("Assets/Resources/Data", "XFrameData"); } AssetDatabase.CreateAsset(asset, "Assets/Resources/Data/XFrameData/XFrame" + count + ".asset"); AssetDatabase.SaveAssets(); count++; return(asset); }
/// <summary> /// Dispatch an URL to given frame. /// Caller can register himself for following result events for dispatched /// URL too. Notifications are guaranteed (instead of dispatch()) /// Returning of the dispatch object isn't necessary. /// Nobody must hold it alive longer the dispatch needs. /// </summary> /// <param name="xFrame">frame wich should be the target of this dispatch</param> /// <param name="aUrl">full parsed and converted office URL for dispatch</param> /// <param name="lProperties">optional arguments for dispatch</param> /// <param name="xListener"> /// optional listener which is registered automatically for status events /// (Note: Deregistration is not supported. Dispatcher does it automatically.) /// </param> public static void ExecuteWithNotification(XFrame xFrame, URL aUrl, PropertyValue[] lProperties, XDispatchResultListener xListener) { try { // Query the frame for right interface which provides access to all available dispatch objects. XDispatchProvider xProvider = (XDispatchProvider)xFrame; // Ask him for right dispatch object for given URL. // Force THIS frame as target for following dispatch. // Attention: The interface XNotifyingDispatch is an optional one! XDispatch xDispatcher = xProvider.queryDispatch(aUrl, "", 0); XNotifyingDispatch xNotifyingDispatcher = (XNotifyingDispatch)xDispatcher; // Dispatch the URL. if (xNotifyingDispatcher != null) { xNotifyingDispatcher.dispatchWithNotification(aUrl, lProperties, xListener); } } catch (RuntimeException exUno) { // Any UNO method of this scope can throw this exception. // But there is nothing we can do then. System.Diagnostics.Debug.WriteLine(exUno); } }
UIElement _configureNavigation(XFrame rootXFrame, Type rootPageType, bool isRoot) { Frame rootFrame = null; if (isRoot) { rootFrame = Window.Current.Content as Frame; } if (rootFrame == null) { rootFrame = new Frame(); } if (isRoot) { Window.Current.Content = rootFrame; } FrameNavigator = new XUWPFrameNavigator(_scope, rootXFrame, rootFrame, _viewResolver, rootPageType); // Ensure the current window is active if (isRoot) { Window.Current.Activate(); } SystemNavigationManager.GetForCurrentView().BackRequested += XUWPFrameManager_BackRequested;; return(rootFrame); }
/// <summary> /// Try to close the document without any saving of modifications. /// We can try it only! Controller and/or model of this document /// can disagree with that. But mostly they doesn't do so. /// </summary> /// <param name="xDocument">document which should be clcosed</param> public static void CloseDocument(XComponent xDocument) { try { // Check supported functionality of the document (model or controller). XModel xModel = (XModel)xDocument; if (xModel != null) { // It's a full featured office document. // Reset the modify state of it and close it. // Note: Model can disagree by throwing a veto exception. XModifiable xModify = (XModifiable)xModel; xModify.setModified(false); xDocument.dispose(); } else { // It's a document which supports a controller .. or may by a pure // window only. If it's at least a controller - we can try to // suspend him. But - he can disagree with that! XController xController = (XController)xDocument; if (xController != null) { if (xController.suspend(true)) { // Note: Don't dispose the controller - destroy the frame // to make it right! XFrame xFrame = xController.getFrame(); xFrame.dispose(); } } } } catch (PropertyVetoException exVeto) { // Can be thrown by "setModified()" call on model. // He disagree with our request. // But there is nothing to do then. Following "dispose()" call wasn't // never called (because we catch it before). Closing failed -that's it. System.Diagnostics.Debug.WriteLine(exVeto); } catch (DisposedException exDisposed) { // If an UNO object was already disposed before - he throw this special // runtime exception. Of course every UNO call must be look for that - // but it's a question of error handling. // For demonstration this exception is handled here. System.Diagnostics.Debug.WriteLine(exDisposed); } catch (RuntimeException exRuntime) { // Every uno call can throw that. // Do nothing - closing failed - that's it. System.Diagnostics.Debug.WriteLine(exRuntime); } }
private void addLabel_Click(object sender, RoutedEventArgs e) { ListView labelbody = createLabel("newlabel"); XFrame frame = createFrame(); labelbody.Items.Add(frame); frame.IsSelected = true; }
void _configureNavigation(XFrame rootFrame, Page rootPage) { //Navigations pages need navigators (which means the child VM's can navigate in them) //Pages like master details don't, their base VM's handle the changing of pages etc... if (rootPage is NavigationPage) { FrameNavigator = new XNavigationPageNavigator(_scope, rootFrame, rootPage as NavigationPage, _viewResolver); } }
async void _navigationModal() { try { var vm = _xNavigation.ModalContentObject as XViewModel; if (vm == null) { var mRoot = _xamarinNavigation.ModalStack?.LastOrDefault(); if (mRoot != null) { var iPopOut = mRoot as XNavigationPageView; if (iPopOut != null) { await iPopOut.AnimateOut(); } } await _xamarinNavigation.PopModalAsync(); return; } var rootFrame = XFrame.CreateRootFrame <XRootFrame>(_scope); rootFrame.IsModal = true; var frameManager = _scope.Resolve <IFrameManager>(); vm.ParentModel = rootFrame; var rootNavigationVm = rootFrame.CreateContentModel <XNavigationPageViewModel>(); var initalViewController = frameManager.Init(rootFrame, rootNavigationVm); rootFrame.NavigateTo(vm); var i = initalViewController as XNavigationPageView; if (i != null) { i.PrepForAnimation(); } await _xamarinNavigation.PushModalAsync(initalViewController, true); if (i != null) { i.AnimateIn(); } } catch (Exception ex) { Debug.WriteLine(ex); } }
public XNavigationMasterDetailNavigator(XFrame rootFrame, MasterDetailPage page, IViewResolver viewResolver) { _rootFrame = rootFrame; _xNavigation = rootFrame.Navigation; _container = rootFrame.Container; _rootNavigationPage = page; _viewResolver = viewResolver; _configure(); }
public XNavigationPageNavigator(ILifetimeScope scope, XFrame rootFrame, NavigationPage page, IViewResolver viewResolver) { _scope = scope; _rootFrame = rootFrame; _xNavigation = rootFrame.Navigation; _container = rootFrame.Container; _rootNavigationPage = page; _viewResolver = viewResolver; _configure(); }
public NavigationPackage(ILifetimeScope container) { _container = container; var frameManager = _container.Resolve <IFrameManager>(); RootFrame = XFrame.CreateRootFrame <XRootFrame>(_container); var rootNavigationVm = RootFrame.CreateContentModel <XNavigationPageViewModel>(); Page = frameManager.Init(RootFrame, rootNavigationVm); ViewModel = RootFrame.CreateContentModel <T>(); }
private XFrame createFrame() { XFrame frame = new XFrame() { Character = currentCharacter }; frame.Selected += selectFrame_Click; frame.MouseUp += selectFrame_Click; frame.Tag = tabControlStruct.SelectedItem; return(frame); }
public XUWPFrameNavigator(ILifetimeScope scope, XFrame rootFrame, Frame rootElement, IUWPViewResolver viewResolver, Type rootPageType) { _scope = scope; _rootFrame = rootFrame; _rootElement = rootElement; _xNavigation = rootFrame.Navigation; _container = rootFrame.Container; _viewResolver = viewResolver; _configure(rootPageType); }
/// <summary> /// Utility for handling animations once the last keyframe in the animation has been reached /// Loop or fire off completion event /// </summary> private void OnAnimationComplete() { switch (active_xAnim.loop) { case false: parent_player._sm.currentState.FireCustomEvent(new EventList.AnimationCompleteEvent(this)); break; default: active_keyframe = active_xAnim.GetNextFrame(active_keyframe); break; } }
/// <summary> /// Unregisters the context menu controler. /// </summary> /// <param name="xFrame">The x frame.</param> public void UnregisterContextMenuControler(XFrame xFrame) { var xController = xFrame.getController(); if (xController != null) { var xContextMenuInterception = xController as XContextMenuInterception; if (xContextMenuInterception != null) { xContextMenuInterception.releaseContextMenuInterceptor(this); System.Diagnostics.Debug.WriteLine("ContextMenue " + this.GetType().Name + " unregisterd"); } } }
private void Init() { keyframe_activeTime = 0; keyframe_startTime = 0; try { active_keyframe = default_xAnim.frames[0]; } catch { Debug.LogError("Missing default animation reference"); } }
private void addNextFrame_Click(object sender, RoutedEventArgs e) { XFrame frame = createFrame(); ListView selectedList = getSelectedList(); if (sender == addMenu) { frame.MenuOptions = new ObservableCollection <XMenuOption> { createMenuOption(true) }; } selectedList.Items.Insert(selectedList.Items.IndexOf(selectedList.SelectedItem) + 1, frame); frame.IsSelected = true; }
private void getPreviousFrames() { XFrame firstframe = currentFrame; for (int i = (currentFrame.Parent as ListView).Items.IndexOf(currentFrame); i >= 0; i--) { previousFrames.Add((currentFrame.Parent as ListView).Items[i] as XFrame); } if ((currentFrame.Tag as XLabel).MenuChoice != null && (currentFrame.Tag as XLabel).Text != "start") { currentFrame = (currentFrame.Tag as XLabel).MenuChoice; getPreviousFrames(); } currentFrame = firstframe; }
private void selectLabel_Click(object sender, RoutedEventArgs e) { if (currentFrame.Tag != tabControlStruct.SelectedItem) { if ((tabControlStruct.SelectedContent as ListView).SelectedItem != null) { XFrame frame = (tabControlStruct.SelectedContent as ListView).SelectedItem as XFrame; frame.IsSelected = false; frame.IsSelected = true; } else { ((tabControlStruct.SelectedContent as ListView).Items[0] as XFrame).IsSelected = true; } } }
public Page InitRoot() { var glue = new TGlue(); glue.Init(); Container = glue.Container; ContainerHost.Container = Container; //sometimes we need to resolve around the place outside of strucutre. RootFrame = XFrame.CreateRootFrame <XRootFrame>(glue.Container.BeginLifetimeScope()); var rootPage = GetRootPage <TRootViewModel>(); return(rootPage); }
/// <summary> /// Try to close the frame instead of the document. /// It shows the possible interface to do so. /// </summary> /// <param name="xFrame">frame which should be clcosed</param> /// <returns> /// <TRUE/> /// in case frame could be closed /// <FALSE/> /// otherwise /// </returns> public static bool CloseFrame(XFrame xFrame) { bool bClosed = false; try { // first try the new way: use new interface XCloseable // It replace the deprecated XTask::close() and should be preferred ... // if it can be queried. XCloseable xCloseable = (XCloseable)xFrame; if (xCloseable != null) { // We deliver the owner ship of this frame not to the (possible) // source which throw a CloseVetoException. We whish to have it // under our own control. try { xCloseable.close(false); bClosed = true; } catch (CloseVetoException) { bClosed = false; } } else { // OK: the new way isn't possible. Try the old one. XTask xTask = (XTask)xFrame; if (xTask != null) { // return value doesn't interest here. Because // we forget this task ... bClosed = xTask.close(); } } } catch (DisposedException) { // Of course - this task can be already dead - means disposed. // But for us it's not important. Because we tried to close it too. // And "already disposed" or "closed" should be the same ... bClosed = true; } return(bClosed); }
private void loadText(XFrame frame, string line) { if (line != "") { if (line.IndexOf('"') == 0) { frame.Character = charNone; } else { frame.Character = characterList.First(item => item.Alias == line.Substring(0, line.IndexOf(' '))); } frame.Text = line.Substring(line.IndexOf('"')).Trim('"'); frame.Content = "[" + frame.Text + ']'; } }
/// <summary> /// Saves train and test data to the specified folder as compressed binary stream. /// </summary> /// <param name="folder">The folder.</param> public void Save(string folder) { try { if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } XFrame.SaveStream(string.Format("{0}\\train.sia", folder)); YFrame.SaveStream(string.Format("{0}\\test.sia", folder)); } catch (Exception e) { throw e; } }
public NavigationPackage(ILifetimeScope container) { _container = container; var frameManager = _container.Resolve <IXUWPFrameManager>(); _frameManager = frameManager; RootFrame = XFrame.CreateRootFrame <XUWPRootFrame>(_container); var rootNavigationVm = RootFrame.CreateContentModel <XUWPNavigationPageViewModel>(); Page = frameManager.Init(RootFrame, rootNavigationVm, false); ViewModel = RootFrame.CreateContentModel <T>(); RootFrame.Activated += RootFrame_Activated; RootFrame.Deactivated += RootFrame_Deactivated; }
public Page Init(XFrame rootFrame, XViewModel rootViewModel) { RootViewModel = rootViewModel; var rootPage = _viewResolver.Resolve(rootViewModel); if (rootPage == null) { throw new InvalidOperationException("Could not resolve the inital views"); } _configureNavigation(rootFrame, rootPage); _configureAlerts(rootPage); rootFrame.Init(); return(rootPage); }
public Page Init(XFrame rootFrame, XViewModel rootViewModel) { RootViewModel = rootViewModel; var rootPage = _viewResolver.Resolve(rootViewModel); if (rootPage == null) { throw new InvalidOperationException("Could not resolve the inital views"); } _configureNavigation(rootFrame, rootPage); _configureAlerts(rootPage); rootFrame.Init(); return rootPage; }
/// <summary> /// Utility for transitioning keyframes once the currernt one has lived past it's lifetime. /// /// </summary> void KeyframeTranstion() { if (keyframe_activeTime - keyframe_startTime > active_keyframe.lifetime) { keyframe_startTime = keyframe_activeTime; hitbox_group.GetComponent <CollisionGroupManager>().collided = false; hurtbox_group.GetComponent <CollisionGroupManager>().collided = false; if (active_keyframe == active_xAnim.GetFinalXFrame()) { OnAnimationComplete(); } else { active_keyframe = active_xAnim.GetNextFrame(active_keyframe); } } }
private void emptyProject() { projectFolder = Environment.CurrentDirectory + @"/temp" + game; //characters characterList.Add(charNone); characterList.Add(charNvl); characterList.Add(charCentered); characterList.Add(charExtend); characterListView.SelectedItem = charNone; characterSelector.SelectedItem = charNone; currentCharacter = charNone; //start ListView startListView = createLabel("start"); XFrame firstFrame = createFrame(); startListView.Items.Add(firstFrame); currentFrame = firstFrame; firstFrame.IsSelected = true; }
public void InitRoot() { var glue = new TGlue(); glue.Init(); Container = glue.Container; ContainerHost.Container = Container; //sometimes we need to resolve around the place outside of strucutre. RootFrame = XFrame.CreateRootFrame <XUWPRootFrame>(glue.Container.BeginLifetimeScope()); //if (!(typeof(TRootViewModel) is XUWPMasterDetailViewModel)) //{ // RootFrame.Activated += RootFrame_Activated; // RootFrame.Deactivated += RootFrame_Deactivated; //} _init <TRootViewModel>(); }
/// <summary> /// Registers the context menu controler. /// </summary> /// <param name="xFrame">The x frame.</param> public void RegisterContextMenuControler(XFrame xFrame) { _xFrame = xFrame; var xController = _xFrame.getController(); if (xController != null) { var xContextMenuInterception = xController as XContextMenuInterception; if (xContextMenuInterception != null) { //var aContextMenuInterceptor = new AbstractContextMenuInterceptorBase(); //var xContextMenuInterceptor = // (XContextMenuInterceptor)aContextMenuInterceptor; //xContextMenuInterception.registerContextMenuInterceptor(xContextMenuInterceptor); xContextMenuInterception.registerContextMenuInterceptor(this); System.Diagnostics.Debug.WriteLine("ContextMenue " + this.GetType().Name + " registerd"); } } }
/// <summary> /// Registers the context menu controler. /// </summary> /// <param name="xFrame">The x frame.</param> public void RegisterContextMenuControler(XFrame xFrame) { _xFrame = xFrame; var xController = _xFrame.getController(); if (xController != null) { var xContextMenuInterception = xController as XContextMenuInterception; if (xContextMenuInterception != null) { //var aContextMenuInterceptor = new AbstractContextMenuInterceptorBase(); //var xContextMenuInterceptor = // (XContextMenuInterceptor)aContextMenuInterceptor; //xContextMenuInterception.registerContextMenuInterceptor(xContextMenuInterceptor); xContextMenuInterception.registerContextMenuInterceptor(this); System.Diagnostics.Debug.WriteLine("ContextMenue "+this.GetType().Name+" registerd"); } } }
public UIElement Init(XFrame rootFrame, XViewModel rootViewModel, bool isRoot) { RootViewModel = rootViewModel; var rootPage = _viewResolver.ResolvePageType(rootViewModel); if (rootPage == null) { throw new InvalidOperationException("Could not resolve the inital views"); } UIElement rootElement = _configureNavigation(rootFrame, rootPage, isRoot); rootFrame.Init(); if (isRoot) { _dispatcher.Invoke(() => rootFrame.NavigateTo(rootViewModel)); } return rootElement; }
/// <summary> /// Dispatch an URL to given frame. /// Caller can register himself for following status events for dispatched /// URL too. But nobody guarantee that such notifications will occur. /// (see dispatchWithNotification() if you interest on that) /// The returned dispatch object should be hold alive by caller /// till he doesn't need it any longer. Otherwise the dispatcher can(!) /// die by decreasing his refcount. /// (Note: Deregistration is part of this listener himself!) /// </summary> /// <param name="xFrame">frame wich should be the target of this dispatch</param> /// <param name="aUrl">full parsed and converted office URL for dispatch</param> /// <param name="lProperties">optional arguments for dispatch</param> /// <param name="xListener">optional listener which is registered automaticly for status events</param> /// <returns> /// It's the used dispatch object and can be used for deregistration of an optional listener. /// Otherwise caller can ignore it. /// </returns> public static XDispatch Execute(XFrame xFrame, URL aUrl, PropertyValue[] lProperties, XStatusListener xListener) { XDispatch xDispatcher; try { // Query the frame for right interface which provides access to all available dispatch objects. XDispatchProvider xProvider = (XDispatchProvider)xFrame; // Ask him for right dispatch object for given URL. // Force given frame as target for following dispatch by using "". // It means the same like "_self". xDispatcher = xProvider.queryDispatch(aUrl, "", 0); // Dispatch the URL into the frame. if (xDispatcher != null) { if (xListener != null) xDispatcher.addStatusListener(xListener, aUrl); xDispatcher.dispatch(aUrl, lProperties); } } catch (RuntimeException exUno) { // Any UNO method of this scope can throw this exception. // But there will be nothing to do then - because // we haven't changed anything inside the remote objects // except method "addStatusListener(). // But in this case the source of this exception has to // rollback all his operations. There is no chance to // make anything right then. // Reset the return value to a default - that's it. System.Diagnostics.Debug.WriteLine(exUno); xDispatcher = null; } return xDispatcher; }
/// <summary> /// Dispatch an URL to given frame. /// Caller can register himself for following result events for dispatched /// URL too. Notifications are guaranteed (instead of dispatch()) /// Returning of the dispatch object isn't necessary. /// Nobody must hold it alive longer the dispatch needs. /// </summary> /// <param name="xFrame">frame wich should be the target of this dispatch</param> /// <param name="aUrl">full parsed and converted office URL for dispatch</param> /// <param name="lProperties">optional arguments for dispatch</param> /// <param name="xListener"> /// optional listener which is registered automatically for status events /// (Note: Deregistration is not supported. Dispatcher does it automatically.) /// </param> public static void ExecuteWithNotification(XFrame xFrame, URL aUrl, PropertyValue[] lProperties, XDispatchResultListener xListener) { try { // Query the frame for right interface which provides access to all available dispatch objects. XDispatchProvider xProvider = (XDispatchProvider)xFrame; // Ask him for right dispatch object for given URL. // Force THIS frame as target for following dispatch. // Attention: The interface XNotifyingDispatch is an optional one! XDispatch xDispatcher = xProvider.queryDispatch(aUrl, "", 0); XNotifyingDispatch xNotifyingDispatcher = (XNotifyingDispatch)xDispatcher; // Dispatch the URL. if (xNotifyingDispatcher != null) xNotifyingDispatcher.dispatchWithNotification(aUrl, lProperties, xListener); } catch (RuntimeException exUno) { // Any UNO method of this scope can throw this exception. // But there is nothing we can do then. System.Diagnostics.Debug.WriteLine(exUno); } }
/// <summary> /// Load document specified by an URL into given frame synchronously. /// The result of this operation will be the loaded document for success /// or null if loading failed. /// </summary> /// <param name="xFrame">frame wich should be the target of this load call</param> /// <param name="sUrl">unparsed URL for loading</param> /// <param name="lProperties">optional arguments</param> /// <returns> /// the loaded document for success or null if it's failed /// </returns> public static XComponent LoadDocument(XFrame xFrame, String sUrl, PropertyValue[] lProperties) { XComponent xDocument; String sOldName = null; try { XComponentContext xCtx = OO.GetContext(); // First prepare frame for loading // We must address it inside the frame tree without any complications. // So we set an unambiguous (we hope it) name and use it later. // Don't forget to reset original name after that. sOldName = xFrame.getName(); String sTarget = "odk_officedev_desk"; xFrame.setName(sTarget); // Get access to the global component loader of the office // for synchronous loading the document. var xLoader = (XComponentLoader)xCtx.getServiceManager().createInstanceWithContext(OO.Services.FRAME_DESKTOP, xCtx); // Load the document into the target frame by using his name and // special search flags. xDocument = xLoader.loadComponentFromURL( sUrl, sTarget, FrameSearchFlag.CHILDREN, lProperties); // don't forget to restore old frame name ... xFrame.setName(sOldName); } catch (unoidl.com.sun.star.io.IOException exIo) { // Can be thrown by "loadComponentFromURL()" call. // The only thing we should do then is to reset changed frame name! System.Diagnostics.Debug.WriteLine(exIo); xDocument = null; if (sOldName != null) xFrame.setName(sOldName); } catch (IllegalArgumentException exIllegal) { // Can be thrown by "loadComponentFromURL()" call. // The only thing we should do then is to reset changed frame name! System.Diagnostics.Debug.WriteLine(exIllegal); xDocument = null; if (sOldName != null) xFrame.setName(sOldName); } catch (RuntimeException exRuntime) { // Any UNO method of this scope can throw this exception. // The only thing we can try(!) is to reset changed frame name. System.Diagnostics.Debug.WriteLine(exRuntime); xDocument = null; if (sOldName != null) xFrame.setName(sOldName); } catch (unoidl.com.sun.star.uno.Exception exUno) { // "createInstance()" method of used service manager can throw it. // The only thing we should do then is to reset changed frame name! System.Diagnostics.Debug.WriteLine(exUno); xDocument = null; if (sOldName != null) xFrame.setName(sOldName); } return xDocument; }
/// <summary> /// Try to close the frame instead of the document. /// It shows the possible interface to do so. /// </summary> /// <param name="xFrame">frame which should be clcosed</param> /// <returns> /// <TRUE/> /// in case frame could be closed /// <FALSE/> /// otherwise /// </returns> public static bool CloseFrame(XFrame xFrame) { bool bClosed = false; try { // first try the new way: use new interface XCloseable // It replace the deprecated XTask::close() and should be preferred ... // if it can be queried. XCloseable xCloseable = (XCloseable)xFrame; if (xCloseable != null) { // We deliver the owner ship of this frame not to the (possible) // source which throw a CloseVetoException. We whish to have it // under our own control. try { xCloseable.close(false); bClosed = true; } catch (CloseVetoException) { bClosed = false; } } else { // OK: the new way isn't possible. Try the old one. XTask xTask = (XTask)xFrame; if (xTask != null) { // return value doesn't interest here. Because // we forget this task ... bClosed = xTask.close(); } } } catch (DisposedException) { // Of course - this task can be already dead - means disposed. // But for us it's not important. Because we tried to close it too. // And "already disposed" or "closed" should be the same ... bClosed = true; } return bClosed; }
/// <summary> /// Registers the context menu controler. /// </summary> /// <param name="xModel">The x model.</param> public void RegisterContextMenuControler(XModel xModel) { _xFrame = xModel.getCurrentController().getFrame(); RegisterContextMenuControler(_xFrame); }