📄 avform.cs
字号:
using System;
using System.IO;
using System.Xml;
using System.Threading;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using gowk.core.managers;
using gowk.core.packets;
using gowk.core.packets.querys;
using gowk.net.Sockets;
using gowk.core;
using gowk.net;
using gowk.controls;
using gowk.multimedia;
namespace gowk.forms
{
/// <summary>
/// AVForm 的摘要说明。
/// </summary>
public class AVForm :gowk.controls.GForm
{
gowk.multimedia.AV av;
Form master;
private gowk.controls.GButton remote;
private gowk.controls.GButton local;
private Image upImage,downImage;
private gowk.controls.GPanel gPanel1;
private gowk.controls.GPanel gPanel2;
private gowk.controls.GButton gButton3;
gowk.multimedia.Mixer mixer;
gowk.multimedia.Mixer.MixerControlDetail indtl,outdtl;
private System.Windows.Forms.ProgressBar involume;
private System.Windows.Forms.ProgressBar outvolume;
gowk.common.SkinConfig skf;
private gowk.controls.GButton btnoutvalume;
private gowk.controls.GButton btninvolume;
private System.Windows.Forms.PictureBox r;
private System.Windows.Forms.PictureBox l;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public AVForm()
{
InitializeComponent();
this.InitializeMixing();
gowk.common.SkinConfig.Instance.SkinChanged+=new EventHandler(Instance_SkinChanged);
this.LoadSkin();
this.l.Visible=false;
this.r.Visible=true;
int h=this.remote.Height+this.local.Height+40+r.Height;
if(this.ImageTopLeft!=null)h+=this.ImageTopLeft.Height;
if(this.ImageBottomLeft!=null)h+=this.ImageBottomLeft.Height;
this.Height=h;
}
public AVForm(Form master):this()
{
this.master=master;
this.master.Move+=new EventHandler(master_Move);
this.master.VisibleChanged+=new EventHandler(master_VisibleChanged);
this.master.SizeChanged+=new EventHandler(master_SizeChanged);
}
private void InitializeMixing()
{
mixer=new Mixer(this);
mixer.MixerControlChange+=new EventHandler(mixer_MixerControlChange);
this.outdtl=new gowk.multimedia.Mixer.MixerControlDetail(mixer,gowk.multimedia.Mixer.MIXERLINE_COMPONENTTYPE_DST_SPEAKERS);
this.outvolume.Minimum=this.outdtl.Min;
this.outvolume.Maximum=this.outdtl.Max;
this.outvolume.Value=this.outdtl.Volume;
this.indtl=new gowk.multimedia.Mixer.MixerControlDetail(mixer,gowk.multimedia.Mixer.MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE);
this.involume.Minimum=indtl.Min;
this.involume.Maximum=indtl.Max;
this.involume.Value=this.indtl.Volume;
}
private void SyncVolumn()
{
this.involume.Value=this.indtl.Volume;
this.outvolume.Value=this.outdtl.Volume;
// this.btnoutvalume.BackgroundImage=this.indtl.Mute?skf.GetImage("/gowk_skin/images/avform/speakerdisabled"):skf.GetImage("/gowk_skin/images/avform/speaker");
// this.btninvolume.BackgroundImage=this.outdtl.Mute?skf.GetImage("/gowk_skin/images/avform/microphonedisabled"):skf.GetImage("/gowk_skin/images/avform/microphone");
}
private void mixer_MixerControlChange(object sender, EventArgs e)
{
this.SyncVolumn();
}
private void Instance_SkinChanged(object sender, EventArgs e)
{
this.LoadSkin();
}
public void Initialize()
{
if(av!=null)this.av.Dispose();
this.av=new AV(this.l,this.r);
this.av.IniChanel();
}
public AV AV
{
get{return this.av;}
}
public void Connect(string ip,int port)
{
this.av.IniAudio();
this.av.IniVideo();
this.av.Start(ip,port);
}
public void Stop()
{
if(this.av!=null)this.av.Dispose();
}
private void LoadSkin()
{
skf=gowk.common.SkinConfig.Instance;
this.upImage=skf.GetImage("/gowk_skin/images/avform/up");
this.downImage=skf.GetImage("/gowk_skin/images/avform/down");
this.local.GImage.ActiveImage=this.local.GImage.PressedImage=this.local.GImage.NormalImage=null;
this.remote.GImage.ActiveImage=this.remote.GImage.PressedImage=this.remote.GImage.NormalImage=null;
this.remote.GImage.Image=this.r.Visible?this.upImage:this.downImage;
this.local.GImage.Image=this.l.Visible?this.upImage:this.downImage;
this.ImageTopLeft=skf.GetImage("/gowk_skin/images/form/t1");
this.ImageTopCenter=skf.GetImage("/gowk_skin/images/form/t2");
this.ImageTopRight=skf.GetImage("/gowk_skin/images/form/t3");
this.ImageMiddleLeft=skf.GetImage("/gowk_skin/images/form/m1");
this.ImageMiddleCenter=skf.GetImage("/gowk_skin/images/form/m2");
this.ImageMiddleRight=skf.GetImage("/gowk_skin/images/form/m3");
this.ImageBottomLeft=skf.GetImage("/gowk_skin/images/form/b1");
this.ImageBottomCenter=skf.GetImage("/gowk_skin/images/form/b2");
this.ImageBottomRight=skf.GetImage("/gowk_skin/images/form/b3");
this.btnoutvalume.BackgroundImage=skf.GetImage("/gowk_skin/images/avform/speaker");
this.btninvolume.BackgroundImage=skf.GetImage("/gowk_skin/images/avform/microphone");
// this.btnoutvalume.BackgroundImage=this.indtl.Mute?skf.GetImage("/gowk_skin/images/avform/speakerdisabled"):skf.GetImage("/gowk_skin/images/avform/speaker");
// this.btninvolume.BackgroundImage=this.outdtl.Mute?skf.GetImage("/gowk_skin/images/avform/microphonedisabled"):skf.GetImage("/gowk_skin/images/avform/microphone");
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
mixer.MixerControlChange-=new EventHandler(mixer_MixerControlChange);
gowk.common.SkinConfig.Instance.SkinChanged-=new EventHandler(Instance_SkinChanged);
try
{
this.av.Dispose();
}
catch(System.Exception ex)
{
gowk.utility.Diagnostics.Debug.Write(ex);
}
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AVForm));
this.remote = new gowk.controls.GButton();
this.local = new gowk.controls.GButton();
this.gPanel1 = new gowk.controls.GPanel();
this.gPanel2 = new gowk.controls.GPanel();
this.gButton3 = new gowk.controls.GButton();
this.outvolume = new System.Windows.Forms.ProgressBar();
this.btnoutvalume = new gowk.controls.GButton();
this.btninvolume = new gowk.controls.GButton();
this.involume = new System.Windows.Forms.ProgressBar();
this.r = new System.Windows.Forms.PictureBox();
this.l = new System.Windows.Forms.PictureBox();
this.gPanel1.SuspendLayout();
this.gPanel2.SuspendLayout();
this.SuspendLayout();
//
// remote
//
this.remote.BackColor = System.Drawing.Color.Transparent;
this.remote.Dock = System.Windows.Forms.DockStyle.Top;
this.remote.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.remote.IsRound = true;
this.remote.Location = new System.Drawing.Point(0, 22);
this.remote.Name = "remote";
this.remote.Size = new System.Drawing.Size(168, 20);
this.remote.TabIndex = 1;
this.remote.Click += new System.EventHandler(this.remote_Click);
//
// local
//
this.local.BackColor = System.Drawing.Color.Transparent;
this.local.Dock = System.Windows.Forms.DockStyle.Bottom;
this.local.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.local.IsRound = true;
this.local.Location = new System.Drawing.Point(0, 332);
this.local.Name = "local";
this.local.Size = new System.Drawing.Size(168, 20);
this.local.TabIndex = 3;
this.local.Click += new System.EventHandler(this.local_Click);
//
// gPanel1
//
this.gPanel1.BackColor = System.Drawing.Color.Transparent;
this.gPanel1.Controls.Add(this.gPanel2);
this.gPanel1.Controls.Add(this.l);
this.gPanel1.Controls.Add(this.r);
this.gPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gPanel1.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.gPanel1.IsRound = true;
this.gPanel1.Location = new System.Drawing.Point(0, 42);
this.gPanel1.Name = "gPanel1";
this.gPanel1.Size = new System.Drawing.Size(168, 290);
this.gPanel1.TabIndex = 5;
//
// gPanel2
//
this.gPanel2.Controls.Add(this.gButton3);
this.gPanel2.Controls.Add(this.outvolume);
this.gPanel2.Controls.Add(this.btnoutvalume);
this.gPanel2.Controls.Add(this.btninvolume);
this.gPanel2.Controls.Add(this.involume);
this.gPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.gPanel2.GBorderStyle = gowk.controls.GBorderStyle.Solid;
this.gPanel2.IsRound = true;
this.gPanel2.Location = new System.Drawing.Point(0, 124);
this.gPanel2.Name = "gPanel2";
this.gPanel2.Size = new System.Drawing.Size(168, 38);
this.gPanel2.TabIndex = 6;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -