Пример #1
0
        public void LoadPlayer(string presetName, bool autoPlay)
        {
            string indexVal    = RTSPPresets.GetValue(PresetColumn.Index, presetName);
            int    presetIndex = 0;

            if (indexVal != "")
            {
                presetIndex = int.Parse(indexVal);
            }

            if (presetIndex >= RTSPPresets.currentPresetCount)
            {
                presetIndex = MainForm.m.mainPlayer.attachedPlayers.IndexOf(myDetached) + 1;
                if (presetIndex >= RTSPPresets.currentPresetCount)
                {
                    return;
                }
            }

            cB_RTSP.SelectedIndex = presetIndex;

            if (autoPlay)
            {
                myDetached.Play(false, false);
            }
            if (isMainPlayer)
            {
                MainForm.m.setPage.cB_IPCon_MainPlayerPreset.SelectedIndex = cB_RTSP.SelectedIndex;
            }
        }
Пример #2
0
        public void Detach(Detached detachable, bool destroy)
        {
            TabPage tp = detachable.settings.myLinkedPage;

            if (tp != null && settings.tC_PlayerSettings.TabPages.Contains(tp))
            {
                settings.tC_PlayerSettings.TabPages.Remove(tp);
            }

            detachable.RemoveSelfFromList();

            attachedPlayers.Remove(detachable);

            if (destroy)
            {
                detachable.DestroyPlayer();
                return;
            }

            detachable.settings.myLinkedPage = null;
            detachable.settings.isAttached   = false;

            bool wasPlaying = false;

            if (detachable.IsPlaying())
            {
                wasPlaying = true;
            }

            detachable.StopPlaying();
            detachable.settings.b_Detach.Text = "Attach";

            detachable.p_Player.Dispose();

            detachable.p_Player = (Panel)Tools.GetAllType(detachable, typeof(Panel)).First();
            detachable.Show();

            if (wasPlaying)
            {
                detachable.Play(false, false);
            }
        }