public ZoneContextWindow(PASubSystem system, PASection section, PAZone zone)
        {
            InitializeComponent();

            App app = App.Current as App;

            if (app.AppBkBrush != null)
            {
                Background = app.AppBkBrush;
            }

            _system  = system;
            _section = section;
            _zone    = zone;

            if (_section != null)
            {
                btnZoneName.Content = _section.Name;
            }

            if (_zone != null)
            {
                btnZoneName.Content = _zone.Name;
            }
        }
示例#2
0
        private bool LoadServerInfo()
        {
            ClearServerInfo();

            PARemoteProc proxy = GetPARpc();

            pa_section[] sections = proxy.GetSections();
            if (sections != null)
            {
                foreach (pa_section section in sections)
                {
                    PASection se = new PASection(section.pa_section_id,
                                                 section.pa_section_name);
                    _sections.Add(se);

                    GetSectionZones(proxy, se);

                    GetSectionMusic(proxy, se);

                    GetSectionCDMusic(proxy, se);

                    GetSectionMusicChannel(proxy, se);
                }
            }

            DialRule.SectionLength     = proxy.GetPASectionIdLength();
            DialRule.ZoneLength        = proxy.GetPAZoneIdLength();
            DialRule.MusicFolderLength = proxy.GetMusicFolderIdLength();
            DialRule.MusicFileLength   = proxy.GetMusicFileIdLength();

            return(true);
        }
        private List <PASection> GetTargetSections()
        {
            if (_section == null && _zone == null)
            {
                return(null);
            }

            List <PASection> sections = new List <PASection>();

            if (_section != null)
            {
                sections.Add(_section);
            }
            else if (_zone != null)
            {
                PASection sc = _system.GetPASectionById(_zone.SectionId);
                if (sc != null)
                {
                    PASection section = new PASection(sc.Id, sc.Name);
                    section.AddPAZone(_zone);
                    sections.Add(section);
                }
            }

            return(sections);
        }
示例#4
0
        private PASection PopMiniIdSection()
        {
            PASection min = null;

            foreach (PASection section in Sections)
            {
                if (min == null)
                {
                    min = section;
                    continue;
                }

                if (min.Id > section.Id)
                {
                    min = section;
                }
            }

            if (min != null)
            {
                Sections.Remove(min);
            }

            return(min);
        }
示例#5
0
        private void lbxSection_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            PASection section = lbxSection.SelectedItem as PASection;

            if (section == null)
            {
                return;
            }

            lbxZone.ItemsSource = section.GetZoneLines(_system.Setting.LineZoneCount);
        }
示例#6
0
        private void btnSection_Click(object sender, RoutedEventArgs e)
        {
            Button    button = sender as Button;
            PASection item   = button.DataContext as PASection;

            if (lbxSection.SelectedItem != item)
            {
                lbxSection.SelectedItem = item;
            }
            else
            {
            }
        }
示例#7
0
        private void GetSectionCDMusic(PARemoteProc proxy, PASection section)
        {
            cd_music_file[] files = proxy.GetMusicCDFiles(section.Id);
            if (files == null)
            {
                return;
            }

            foreach (cd_music_file file in files)
            {
                BKMusicCDFile fi = new BKMusicCDFile(file.cd_music_id,
                                                     file.cd_music_name);
                section.MusicCDFiles.Add(fi);
            }
        }
        public MusicSelectWindow(PASubSystem system, PASection section, PAZone zone)
        {
            InitializeComponent();

            App app = App.Current as App;

            if (app.AppBkBrush != null)
            {
                Background = app.AppBkBrush;
            }

            _system  = system;
            _section = section;
            _zone    = zone;
        }
示例#9
0
        private void GetSectionMusicChannel(PARemoteProc proxy, PASection section)
        {
            music_channel[] channels = proxy.getMusicChannels(section.Id);
            if (channels == null)
            {
                return;
            }

            foreach (music_channel channel in channels)
            {
                BKMusicRadioChannel ch = new BKMusicRadioChannel(channel.radio_channel_id,
                                                                 channel.radio_channel_name);
                section.MusicRadioChannels.Add(ch);
            }
        }
示例#10
0
        private void GetFolderMusic(PARemoteProc proxy, PASection section, BKMusicFolder folder)
        {
            music_file[] files = proxy.GetMusicFiles(section.Id, folder.Id);
            if (files == null)
            {
                return;
            }

            foreach (music_file file in files)
            {
                BKMusicFile fi = new BKMusicFile(file.music_file_id,
                                                 file.music_file_name);
                folder.AddMusicFile(fi);
            }
        }
示例#11
0
        private void GetSectionZones(PARemoteProc proxy, PASection section)
        {
            pa_zone[] zones = proxy.GetZones(section.Id);
            if (zones == null)
            {
                Log.Error(string.Format("no zone found in PA section {0}", section.Name));
                return;
            }

            foreach (pa_zone zone in zones)
            {
                PAZone zo = new PAZone(zone.pa_zone_id,
                                       zone.pa_zone_name);
                section.AddPAZone(zo);
            }
        }
示例#12
0
        private bool GetSecionZoneIds(ref int sectionIds, ref string zones)
        {
            sectionIds = 0;
            while (true)
            {
                PASection min = PopMiniIdSection();
                if (min == null)
                {
                    break;
                }

                sectionIds |= min.Id;

                zones += BuildZoneString(min.PAZones);
            }
            return(true);
        }
示例#13
0
        private void GetSectionMusic(PARemoteProc proxy, PASection section)
        {
            music_folder[] folders = proxy.GetMusicFolders(section.Id);
            if (folders == null)
            {
                return;
            }

            foreach (music_folder folder in folders)
            {
                BKMusicFolder fo = new BKMusicFolder(folder.music_folder_id,
                                                     folder.music_folder_name);

                section.AddBKMusic(fo);

                GetFolderMusic(proxy, section, fo);
            }
        }
        private void btnFile_Checked(object sender, RoutedEventArgs e)
        {
            btnCD.IsChecked    = false;
            btnRadio.IsChecked = false;

            PASection section = GetPASection();

            if (section == null)
            {
                lstFolders.ItemsSource = null;
                lstFiles.ItemsSource   = null;
                return;
            }

            List <string> foldersName = new List <string>();

            foreach (BKMusicFolder folder in section.MusicFiles)
            {
                foldersName.Add(folder.Name);
            }

            lstFolders.ItemsSource = foldersName;
        }
        private void lstFolders_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (btnFile.IsChecked != true)
            {
                return;
            }

            string name = lstFolders.SelectedItem as string;

            Debug.Assert(name != null);

            PASection section = GetPASection();

            if (section == null)
            {
                lstFiles.ItemsSource = null;
                return;
            }

            BKMusicFolder folder = section.GetMusicFolderByName(name);

            if (folder == null)
            {
                lstFiles.ItemsSource = null;
                return;
            }

            List <string> files = new List <string>();

            foreach (BKMusicFile file in folder.Files)
            {
                files.Add(file.Name);
            }

            lstFiles.ItemsSource = files;
        }
        private void SetMusicFiles()
        {
            string name = lstFolders.SelectedItem as string;

            if (name == null)
            {
                MusicFolder = null;
                return;
            }

            PASection     section = GetPASection();
            BKMusicFolder folder  = section.GetMusicFolderByName(name);

            if (folder == null)
            {
                MusicFolder = null;
                return;
            }

            if (lstFiles.SelectedItems.Count == 0)
            {
                MusicFolder = folder;
            }
            else
            {
                MusicFolder = new BKMusicFolder(folder.Id, folder.Name);
                foreach (string fileName in lstFiles.SelectedItems)
                {
                    BKMusicFile file = folder.GetMusicFile(fileName);
                    if (file != null)
                    {
                        MusicFolder.AddMusicFile(file);
                    }
                }
            }
        }
        private void btnRadio_Checked(object sender, RoutedEventArgs e)
        {
            btnFile.IsChecked = false;
            btnCD.IsChecked   = false;

            PASection section = GetPASection();

            if (section == null)
            {
                lstFolders.ItemsSource = null;
                lstFiles.ItemsSource   = null;
                return;
            }

            List <string> files = new List <string>();

            foreach (BKMusicRadioChannel channel in section.MusicRadioChannels)
            {
                files.Add(channel.Name);
            }

            lstFolders.ItemsSource = files;
            lstFiles.ItemsSource   = null;
        }
示例#18
0
 public bool StopFileMusic(PASection secion)
 {
     return(true);
 }