Beispiel #1
0
        protected override void OnUnloaded()
        {
            this.DataContext = null;
            this.ViewModel.Dispose();
            this.ViewModel = null;

            if (instance == this)
            {
                instance = null;
            }
        }
        public static WindowObjectVehicle Open(
            IDynamicWorldObject objectVehicle,
            FrameworkElement vehicleExtraControl = null,
            IViewModelWithActiveState vehicleExtraControlViewModel = null)
        {
            if (instance is not null &&
                instance.objectVehicle == objectVehicle)
            {
                return(instance);
            }

            var window = new WindowObjectVehicle();

            instance                            = window;
            window.objectVehicle                = objectVehicle;
            window.vehicleExtraControl          = vehicleExtraControl;
            window.vehicleExtraControlViewModel = vehicleExtraControlViewModel;
            Api.Client.UI.LayoutRootChildren.Add(window);
            return(instance);
        }