Ejemplo n.º 1
0
        public void SwitchScene(string sceneName)
        {
            if (!Scenes.Contains(sceneName))
            {
                this.Log($"'{sceneName}' scene doesn't exist");
                return;
            }

            if (CurrentScene == null)
            {
                CurrentScene = Scenes[sceneName];
                CurrentScene.SceneEntered();
                return;
            }

            if (CurrentScene.Name == sceneName)
            {
                this.Log($"'{sceneName}' scene is already showing");
                return;
            }

            CurrentScene.SceneExited();
            CurrentScene = Scenes[sceneName];
            CurrentScene.SceneEntered();
        }
Ejemplo n.º 2
0
        protected async Task LoadScene(Scene scene)
        {
            if (scene == null)
            {
                return;
            }

            if (!Scenes.Contains(scene))
            {
                Scenes.Add(scene);
                scene.PrevScene = Currrent;
            }

            IsLoading = true;

            // await UnloadUIComponent();
            // Currrent = scene;
            // await LoadUIComponent(scene.Content as UIElement);

            await SwitchComponentInSlide(scene.Content as UIElement);

            Currrent = scene;

            IsLoading = false;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set the current item
        /// </summary>
        /// <param name="guid">The guid of the item</param>
        /// <returns>true if the new item is set, false otherwise</returns>
        //public bool SetCurrent(Guid guid)
        //{
        //    var item = Items.Where(x => x.Guid == guid);
        //    if (item.Any())
        //    {
        //        IItem newItem = item.First();
        //        CurrentItem = newItem;

        //        //ResourceDictionary theme = Application.Current.MainWindow.Resources.MergedDictionaries[0];
        //        //ResourceDictionary appTheme = Application.Current.Resources.MergedDictionaries.Count > 0
        //        //                                  ? Application.Current.Resources.MergedDictionaries[0]
        //        //                                  : null;
        //        //theme.BeginInit();
        //        //theme.MergedDictionaries.Clear();
        //        //if (appTheme != null)
        //        //{
        //        //    appTheme.BeginInit();
        //        //    appTheme.MergedDictionaries.Clear();
        //        //}
        //        //else
        //        //{
        //        //    appTheme = new ResourceDictionary();
        //        //    appTheme.BeginInit();
        //        //    Application.Current.Resources.MergedDictionaries.Add(appTheme);
        //        //}
        //        //foreach (Uri uri in newTheme.UriList)
        //        //{
        //        //    ResourceDictionary newDict = new ResourceDictionary {Source = uri};
        //        //    /*AvalonDock and menu style needs to move to the application
        //        //     * 1. AvalonDock needs global styles as floatable windows can be created
        //        //     * 2. Menu's need global style as context menu can be created
        //        //    */
        //        //    if (uri.ToString().Contains("AvalonDock") ||
        //        //        uri.ToString().Contains("Wide;component/Interfaces/Styles/VS2012/Menu.xaml"))
        //        //    {
        //        //        appTheme.MergedDictionaries.Add(newDict);
        //        //    }
        //        //    else
        //        //    {
        //        //        theme.MergedDictionaries.Add(newDict);
        //        //    }
        //        //}
        //        //appTheme.EndInit();
        //        //theme.EndInit();
        //        _logger.Log("projectfile item set to " + newItem.Name, LogCategory.Info, LogPriority.None);
        //        _eventAggregator.GetEvent<ItemChangeEvent>().Publish(newItem);
        //    }
        //    return false;
        //}

        /// <summary>
        /// Adds a base item to the project-file manager
        /// </summary>
        /// <param name="theme">The item to add</param>
        /// <returns>true, if successful - false, otherwise</returns>
        public bool AddScene(SceneDataModel scene)
        {
            if (!Scenes.Contains(scene))
            {
                Scenes.Add(scene);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
 public void AddScene(IGraphScene <TItem, TEdge> scene)
 {
     if (scene != null && !Scenes.Contains(scene))
     {
         Scenes.Add(scene);
         var graph = scene.Graph;
         RegisterBackGraph(graph);
         graph.GraphChange -= this.VisualGraphChange;
         graph.GraphChange += this.VisualGraphChange;
         graph.ChangeData  -= this.VisualGraphChangeData;
         graph.ChangeData  += this.VisualGraphChangeData;
     }
 }