Exemplo n.º 1
0
 public void SetElement(Ares.Data.IModeElement element)
 {
     m_Element = element;
     ElementId = element.Id;
     UpdateTitle();
     UpdateData();
     Actions.ElementChanges.Instance.AddListener(-1, Update);
     Actions.ElementChanges.Instance.AddListener(element.Id, Update);
 }
Exemplo n.º 2
0
        public static void ShowTriggerEditor(Ares.Data.IModeElement element, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent)
        {
            EditorBase existing = EditorRegistry.Instance.GetEditor(element.Id);

            if (existing != null)
            {
                existing.Activate();
            }
            else
            {
                TriggerEditor editor = new TriggerEditor(project);
                editor.SetElement(element);
                ShowEditor(editor, parent);
            }
        }
Exemplo n.º 3
0
        private static void ShowEditor(Ares.Data.IElement element, Ares.Data.IGeneralElementContainer container, Ares.Data.IModeElement modeElement, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent)
        {
            if (element == null)
            {
                return;
            }
            EditorBase existing = EditorRegistry.Instance.GetEditor(element.Id);

            if (existing != null)
            {
                existing.Activate();
            }
            else
            {
                if (element is Ares.Data.IRandomBackgroundMusicList)
                {
                    RandomPlaylistOrBGSoundChoiceEditor editor = new RandomPlaylistOrBGSoundChoiceEditor();
                    editor.SetPlaylist(element as Ares.Data.IRandomBackgroundMusicList, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IBackgroundSoundChoice)
                {
                    RandomPlaylistOrBGSoundChoiceEditor editor = new RandomPlaylistOrBGSoundChoiceEditor();
                    editor.SetBGSoundChoice(element as Ares.Data.IBackgroundSoundChoice, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.ISequentialBackgroundMusicList)
                {
                    SequentialPlaylistEditor editor = new SequentialPlaylistEditor();
                    editor.SetPlaylist(element as Ares.Data.ISequentialBackgroundMusicList, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IMacro)
                {
                    MacroEditor editor = new MacroEditor();
                    editor.SetContainer(element as Ares.Data.IMacro, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IElementContainer <Ares.Data.IChoiceElement> )
                {
                    ChoiceContainerEditor editor = new ChoiceContainerEditor();
                    editor.SetContainer(element as Ares.Data.IElementContainer <Ares.Data.IChoiceElement>, project, false);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.ISequentialContainer)
                {
                    SequentialContainerEditor editor = new SequentialContainerEditor();
                    editor.SetContainer(element as Ares.Data.ISequentialContainer, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IElementContainer <Ares.Data.IParallelElement> )
                {
                    ParallelContainerEditor editor = new ParallelContainerEditor();
                    editor.SetContainer(element as Ares.Data.IElementContainer <Ares.Data.IParallelElement>, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IMusicByTags)
                {
                    MusicByTagsEditor editor = new MusicByTagsEditor();
                    editor.SetElement(element as Ares.Data.IMusicByTags, project);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IReferenceElement)
                {
                    Ares.Data.IElement referencedElement = Ares.Data.DataModule.ElementRepository.GetElement((element as Ares.Data.IReferenceElement).ReferencedId);
                    if (referencedElement != null)
                    {
                        ShowEditor(referencedElement, container, project, parent);
                    }
                }
                else if (element is Ares.Data.IWebRadioElement)
                {
                    WebRadioEditor editor = new WebRadioEditor();
                    editor.SetElement(element as Ares.Data.IWebRadioElement, project, modeElement);
                    ShowEditor(editor, parent);
                }
                else if (element is Ares.Data.IFileElement)
                {
                    Ares.Data.IFileElement fileElement = (Ares.Data.IFileElement)element;
                    if (fileElement.FilePath.EndsWith(".m3u", StringComparison.InvariantCultureIgnoreCase) ||
                        fileElement.FilePath.EndsWith(".m3u8", StringComparison.InvariantCultureIgnoreCase) ||
                        fileElement.FilePath.EndsWith(".pls", StringComparison.InvariantCultureIgnoreCase))
                    {
                        String basePath = fileElement.SoundFileType == Data.SoundFileType.Music ? Ares.Settings.Settings.Instance.MusicDirectory : Ares.Settings.Settings.Instance.SoundDirectory;
                        String filePath = System.IO.Path.Combine(basePath, fileElement.FilePath);
                        System.Diagnostics.Process.Start(filePath);
                    }
                    else
                    {
                        FileElementEditor editor = new FileElementEditor();
                        editor.SetElement(element as Ares.Data.IFileElement, container, project);
                        ShowEditor(editor, parent);
                    }
                }
            }
        }
Exemplo n.º 4
0
 public static void ShowEditor(Ares.Data.IElement element, Ares.Data.IModeElement modeElement, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent)
 {
     ShowEditor(element, null, modeElement, project, parent);
 }