void SetIcon() { var icon = new NotifyIcon { Icon = Properties.Resources.camera, Visible = true, }; Application.ApplicationExit += (o, e) => icon.Dispose(); var version = new ToolStripMenuItem { Text = "Ver. " + Application.ProductVersion, Enabled = false, }; var settings = new ToolStripMenuItem { Text = "Settings..." }; settings.Click += (o, e) => { if (new FormConfig(config).ShowDialog() == DialogResult.OK) { config = Config.Read(); } }; var exit = new ToolStripMenuItem { Text = "Exit" }; exit.Click += (o, e) => Application.Exit(); icon.ContextMenuStrip = new ContextMenuStrip(); icon.ContextMenuStrip.Items.AddRange(new[] { version, settings, exit }); }
public bool EnumerateAudioSources() { try { WMEncoder Encoder = new WMEncoder(); // Retrieve source and device plug-in info manager objects from WMEncoder. IWMEncSourcePluginInfoManager SrcPlugMgr = Encoder.SourcePluginInfoManager; IWMEncDeviceControlPluginInfoManager DCPlugMgr = Encoder.DeviceControlPluginInfoManager; // Loop through all the audio and video devices on the system. IWMEncPluginInfo PlugInfo; for (int i = 0; i < SrcPlugMgr.Count; i++) { // Set the IWMEncPluginInfo object to the current plug-in. PlugInfo = SrcPlugMgr.Item(i); // Find the device plug-ins that support resources. if (PlugInfo.SchemeType == "DEVICE" && PlugInfo.Resources == true) { // Loop through the resources in the current plug-in. for (int j = 0; j < PlugInfo.Count; j++) { //if(frm_Rec.chkAudio.Checked==true) { // Add audio resources to the cboAudioSource combo box. if (PlugInfo.MediaType == WMENC_SOURCE_TYPE.WMENC_AUDIO) { m_sourceEnumDlg.audioSources.Items.Add(PlugInfo.Item(j)); } } } } } } catch (Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Video Recordong Module ===>Screen Capture.cs line==> 147", exp, "Error Enumeration Audio Resources: " + exp.Message.ToString(), true); //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Error Stoping encoder: " + exp.Message.ToString()); //Trace.WriteLine(exp.ToString()+"---"+exp.Message+"---"+exp.Source+exp.StackTrace+"---"+exp.TargetSite+"---"+exp.InnerException); } //DialogResult ret = m_sourceEnumDlg.ShowDialog(); //if( ret == DialogResult.Cancel) // return false; //m_szAudioSource = m_sourceEnumDlg.selectedItem; m_szAudioSource = config.Read("Driver"); return(true); }
public Capture() { config = Config.Read(); SetIcon(); Hook.Register(Process); }