/// <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 AddAnimationEditor(AnimationEditorModel AnimationEditor) { if (!AnimationEditors.Contains(AnimationEditor)) { AnimationEditors.Add(AnimationEditor); return(true); } return(false); }
public ContentViewModel NewContent(object parameter) { var vm = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorViewModel), "") as AnimationEditorViewModel; var model = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorModel), "") as AnimationEditorModel; var view = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorView), "") as AnimationEditorView; //Model details _loggerService.Log("Creating a new simple file using AnimationEditorHandler", LogCategory.Info, LogPriority.Low); //Clear the undo stack // model.Document.UndoStack.ClearAll(); //Set the model and view vm.SetModel(model); vm.SetView(view); vm.Title = "AnimationEditor"; (vm.View as UserControl).DataContext = model; vm.SetHandler(this); model.SetDirty(true); model.SetLocation("AnimationEditorID:##:"); IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService; AnimationEditorManager AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorManager), "") as AnimationEditorManager; AnimationEditorService.AnimationEditors.Add(model); model.GraphViewModel = view.GraphControl.DataContext as GraphViewModel; AnimationEditorService.AnimationEditors[0].GraphViewModel.AddElement <OutputNodeViewModel>(300, 200); PItem parent = null; if (pfExplorerService.SelectedItem != null) { parent = pfExplorerService.SelectedItem; } AnimationEditorModel newAnimationEditor = new AnimationEditorModel(); newAnimationEditor.Parent = parent; if (pfExplorerService.SelectedItem != null) { pfExplorerService.SelectedItem.Items.Add(newAnimationEditor); } AnimationEditorService.AnimationEditors.Add(newAnimationEditor); // AnimationEditorService.SelectedAnimationEditor = newAnimationEditor; newAnimationEditor.Open(-1); return(vm); }
/// <summary> /// Opens a file and returns the corresponding MDViewModel /// </summary> /// <param name="info">The string location of the file</param> /// <returns>The <see cref="MDViewModel"/> for the file.</returns> public ContentViewModel OpenContent(object info, object param) { var location = info as string; if (location != null) { AnimationEditorModel model = null; AnimationEditorViewModel vm = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorViewModel), "") as AnimationEditorViewModel; var view = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorView), "") as AnimationEditorView; try { // IAnimationEditorService AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(IAnimationEditorService), "") as IAnimationEditorService; IProjectTreeService pfExplorerService = VEFModule.UnityContainer.Resolve(typeof(IProjectTreeService), "") as IProjectTreeService; AnimationEditorManager AnimationEditorService = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorManager), "") as AnimationEditorManager; // string[] split = Regex.Split(info.ToString(), ":##:"); //if (split.Count() == 2) //{ // string identifier = split[0]; // string ID = split[1]; // if (identifier == "AnimationEditorID") // { var AnimationEditor = AnimationEditorService.AnimationEditors.Where(x => x.ContentID == info.ToString()); if (AnimationEditor.Any()) { AnimationEditorService.SelectedAnimationEditor = AnimationEditor.First(); AnimationEditorService.SelectedAnimationEditor.Open(info); } else //new AnimationEditor { // AnimationEditorModel newAnimationEditor = new AnimationEditorModel() { Name = "AnimationEditor NEW", ContentID = "AnimationEditorID:##:" }; // newAnimationEditor.Parent = parent; if (pfExplorerService.SelectedItem is AnimationEditorModel) { // pfExplorerService.SelectedItem.Items.Add(newAnimationEditor); var newAnimationEditor = pfExplorerService.SelectedItem as AnimationEditorModel; if (newAnimationEditor != null) { AnimationEditorService.AnimationEditors.Add(newAnimationEditor); // AnimationEditorService.SelectedAnimationEditor = newAnimationEditor; newAnimationEditor.Open(-1); model = newAnimationEditor; } } } //Model details if (model == null) { model = VEFModule.UnityContainer.Resolve(typeof(AnimationEditorModel), "") as AnimationEditorModel; AnimationEditorService.AnimationEditors.Add(model); } model.GraphViewModel = view.GraphControl.DataContext as GraphViewModel; AnimationEditorService.AnimationEditors[0].GraphViewModel.AddElement <OutputNodeViewModel>(300, 200); model.SetLocation(info); // model.SetLocation("AuftragID:##:" + info + ""); // model.Document.Text = File.ReadAllText(location); model.SetDirty(true); // } } catch (Exception exception) { _loggerService.Log(exception.Message, LogCategory.Exception, LogPriority.High); _loggerService.Log(exception.StackTrace, LogCategory.Exception, LogPriority.High); return(null); } //Clear the undo stack // model.Document.UndoStack.ClearAll(); //Set the model and view vm.SetModel(model); vm.SetView(view); vm.Title = "AnimationEditorViewer";//model.nae // Path.GetFileName("AnimationEditor gefunden"); (vm.View as UserControl).DataContext = model; return(vm); } return(null); }
public AnimationEditorItemEventArgs(AnimationEditorModel AnimationEditorItem) { AnimationEditorItem = AnimationEditorItem; }