示例#1
2
 public ShowAlarm()
 {
     InitializeComponent();
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     iVolume = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100); ;
 }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();

            _interceptor.Initialize();
            _interceptor.AddCallback(OnKeyAction);

            // Get the active microphone and speakers
            MMDeviceEnumerator deviceEnumerator = new MMDeviceEnumerator();
            MMDeviceCollection micList = deviceEnumerator.EnumerateAudioEndPoints(EDataFlow.eCapture, EDeviceState.DEVICE_STATE_ACTIVE);
            MMDeviceCollection speakerList = deviceEnumerator.EnumerateAudioEndPoints(EDataFlow.eRender, EDeviceState.DEVICE_STATE_ACTIVE);

            _activeSpeaker = deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            _volumeRange = _activeSpeaker.AudioEndpointVolume.VolumeRange;
            _normalSpeakerVolume = _activeSpeaker.AudioEndpointVolume.MasterVolumeLevel;

            // ?? TODO: Add support for selecting applications that when their audio is above a certain level, turn down the audio of other applications.
            //DevicePeriod dp = _activeSpeaker.DevicePeriod;
            //Console.WriteLine(dp.DefaultPeriod);
            //Console.WriteLine(dp.MinimumPeriod);

            for (int i = 0; i < micList.Count; i++) {
                MMDevice mic = micList[i];
                _microphones.Add(mic);
                Console.WriteLine("Found microphone: " + mic.FriendlyName + " " + mic.ID);
            }

            for (int i = 0; i < speakerList.Count; i++) {
                MMDevice speaker = speakerList[i];
                _speakers.Add(speaker);
                Console.WriteLine("Found speaker: " + speaker.FriendlyName + " " + speaker.ID);
            }

            MinimizeToTray.Initialize(this, _muteIcon);
        }
示例#3
0
 public void Initialize(IntPtr handle)
 {
     MMDeviceEnumerator devEnum = new MMDeviceEnumerator ();
     m_device = devEnum.GetDefaultAudioEndpoint (EDataFlow.eRender, ERole.eMultimedia);
     NativeMethods.RegisterHotKey(handle, VolumeDown, NativeMethods.KeyModifiers.None, Keys.VolumeDown);
     NativeMethods.RegisterHotKey(handle, VolumeUp, NativeMethods.KeyModifiers.None, Keys.VolumeUp);
     NativeMethods.RegisterHotKey(handle, VolumeMute, NativeMethods.KeyModifiers.None, Keys.VolumeMute);
 }
示例#4
0
 /// <summary>
 /// Private constructor
 /// </summary>
 MasterVolume()
     : base("master", "Master Volume", DeviceCapabilities.Volume | DeviceCapabilities.SetMuted | DeviceCapabilities.GetMuted | DeviceCapabilities.LFEVolume)
 {
     var devices = new MMDeviceEnumerator();
     _defaultDevice = devices.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     _defaultDevice.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
     this.Save();
 }
示例#5
0
 public WinApi()
 {
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     //tbMaster.Value = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
     //device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
     //timer1.Enabled = true;
 }
        public VolumeDetectorVista()
        {
            devEnum = new MMDeviceEnumerator();
            defaultDevice =
              devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

            defaultDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(this.DelegateNotification);
        }
示例#7
0
        public AppContext()
            : base()
        {
            bool ok = false;
            if (Environment.OSVersion.Version.Major > 5)
            {
                // Vista & higher
                ok = true;

                MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
                this.defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                this.defaultDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
            }
            else
            {
                this.spkrVolumeControlID = MM.GetControlID(spkrComponent, spkrVolumeControl);
                this.spkrMuteControlID = MM.GetControlID(spkrComponent, spkrMuteControl);

                if (this.spkrVolumeControlID > 0)
                {
                    ok = true;

                    int v = MM.GetVolume(spkrVolumeControl, spkrComponent);
                    this.currentVolume = ConvertToPercentage(v);

                    this.hwnd = new Hwnd(WndProc);
                    int iw = (int)this.hwnd.Handle;

                    // ... and we can now activate the message monitor 
                    bool b = MM.MonitorControl(iw);
                }
            }

            if (ok)
            {
                NotificationType ntUp = new NotificationType(ntNameVolumeUp);
                NotificationType ntDown = new NotificationType(ntNameVolumeDown);
                NotificationType[] types = new NotificationType[] { ntUp, ntDown };
                Growl.Connector.Application app = new Growl.Connector.Application(appName);
                app.Icon = Properties.Resources.volumeter;

                this.growl = new GrowlConnector();
                this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
                this.growl.Register(app, types);

                this.timer = new System.Timers.Timer(buffer);
                this.timer.AutoReset = false;
                this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            }
            else
            {
                MessageBox.Show("No speaker/line out component found to monitor");
            }
        }
示例#8
0
        public MainViewModel()
            : base()
        {
            visibilityTimer = new Timer(2000);
            visibilityTimer.Elapsed += visibilityTimerElapsed;
            visibilityTimer.AutoReset = false;

            deviceEnumerator = new MMDeviceEnumerator();
            device = deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            device.AudioEndpointVolume.OnVolumeNotification += VolumeChanged;
        }
示例#9
0
        /// <summary>
        /// Initializes an instance of the class <see cref="AudioAnalyzer"/>
        /// </summary>
        public AudioAnalyzer()
        {
            this._fftDataBuffer = new float[1024];
            this._wasapiProcessCallback = new WASAPIPROC(this.WasapiProcessCallBack);

            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATETHREADS, false);
            Bass.BASS_Init(0, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);

            var devEnum = new MMDeviceEnumerator();
            this._mmAudioDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            this._mmAudioDevice.AudioEndpointVolume.OnVolumeNotification += this.AudioEndpointVolume_OnVolumeNotification;
        }
示例#10
0
        public DataSources(List<Meter> meters)
        {
            prevFileCheck = new Dictionary<string, DateTime>();
            prevFileValue = new Dictionary<string, int>();

            monitor = new NetworkMonitor();
            adapters = monitor.Adapters;

            MEMORYSTATUSEX memStatus = new MEMORYSTATUSEX();
            if (GlobalMemoryStatusEx(memStatus))
                TotalRAM = (int)((float)memStatus.ullTotalPhys / 1024 / 1024);

            bool startedMonitoring = false;

            foreach (Meter meter in meters)
                switch (meter.Data)
                {
                    case "CPU usage":
                        if (cpuCounter == null)
                        {
                            cpuCounter = new PerformanceCounter();
                            cpuCounter.CategoryName = "Processor";
                            cpuCounter.CounterName = "% Processor Time";
                            cpuCounter.InstanceName = "_Total";
                        }
                        break;
                    case "Available memory":
                    case "Used memory":
                        if (ramCounter == null)
                            ramCounter = new PerformanceCounter("Memory", "Available MBytes");
                        break;
                    case "Recycle bin file count":
                    case "Recycle bin size":
                        binQuery = new SHQUERYRBINFO();
                        break;
                    case "Download speed":
                    case "Upload speed":
                        if (!startedMonitoring)
                        {
                            monitor.StartMonitoring();
                            startedMonitoring = true;
                        }
                        break;
                    case "System volume":
                    case "Audio peak level":
                        if (audioDevice == null)
                        {
                            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
                            audioDevice = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                        }
                        break;
                }
        }
示例#11
0
        public MainWindow()
        {
            InitializeComponent();
            this.Topmost = true;
            this.WindowStartupLocation = WindowStartupLocation.Manual;
            this.Left = SystemParameters.PrimaryScreenWidth - 200;
            this.Top = SystemParameters.PrimaryScreenHeight - 100;

            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
            device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            lblVolume.Content = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
            device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
        }
示例#12
0
 // Class constructor
 public MainForm()
 {
     this.WindowState = FormWindowState.Maximized;
     InitializeComponent();
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     auddevice = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     auddevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
     backgroundWorker1.RunWorkerAsync();
     glyphsImageList.ImageSize = new Size(32, 32);
     glyphList.LargeImageList = glyphsImageList;
     bordersToolStripMenuItem.Tag = VisualizationType.BorderOnly;
     namesToolStripMenuItem.Tag = VisualizationType.Name;
     imagesToolStripMenuItem.Tag = VisualizationType.Image;
     modelToolStripMenuItem.Tag = VisualizationType.Model;
 }
示例#13
0
文件: Form1.cs 项目: hwchiu0810/micro
        public Form1()
        {
            InitializeComponent();

            this.usbToolStripStatusLabel.Text = "RGB Bargraph Device Detached";

            // Serial stuff.
            try
            {
                //serSerialPort.PortName = "COM10";
                serSerialPort.Open();
                serAttach = true;
                this.usbToolStripStatusLabel.Text = "Serial port device attached.";

            }
            catch (Exception exe)
            {
                //MessageBox.Show("ERROR: " + exe);
                serAttach = false;
                this.usbToolStripStatusLabel.Text = "Serial port device not found...";

            }

            // Initialise the status strip text
            //this.usbToolStripStatusLabel.Text = "RGB Bargraph Device Detached";

            // Create the USB reference device object (passing VID and PID)
            theRgbBargraphDevice = new rgbBargraphDevice(0x04D8, 0x0100);

            // Register for device change notifications
            theRgbBargraphDevice.registerForDeviceNotifications(this.Handle);

            // Add a listener for usb events
            theRgbBargraphDevice.usbEvent +=
                new rgbBargraphDevice.usbEventsHandler(usbEvent_receiver);

            // Perform an initial search for the target device
            theRgbBargraphDevice.findTargetDevice();

            // Initialise the core audio API
            MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
            defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

            // Set the starting value for the LED fade off speed
            theRgbBargraphDevice.setLedFadeOffSpeed((int)ledFadeOffSpeedTrackBar.Value);
        }
示例#14
0
        public MainModule()
        {
            MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
            defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

            string html1 = "<html><body>Current volume: ";
            string html2 = "%.<br /><br /><a href='/p5'>+5</a><br /><a href='/p10'>+10</a><br /><a href='/m5'>-5</a><br /><a href='/m10'>-10</a>";

            Get["/"] = parameters =>
            {
                Console.WriteLine("/");
                return html1 + (defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100).ToString() + html2;
            };

            Get["/p5"] = parameters =>
                {
                    Console.WriteLine("+5");
                    defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar = validateVol(defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar + (float)0.05);
                    return html1 + (defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100).ToString() + html2;
                };

            Get["/p10"] = parameters =>
            {
                Console.WriteLine("+10");
                defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar = validateVol(defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar + (float)0.1);
                return html1 + (defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100).ToString() + html2;
            };

            Get["/m5"] = parameters =>
            {
                Console.WriteLine("-5");
                defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar = validateVol(defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar - (float)0.05);
                return html1 + (defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100).ToString() + html2;
            };

            Get["/m10"] = parameters =>
            {
                Console.WriteLine("-10");
                defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar = validateVol(defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar - (float)0.1);
                return html1 + (defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100).ToString() + html2;
            };
        }
示例#15
0
        public MainWindow()
        {
            InitializeComponent();

            runner = new Thread(()=>
            {
                MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
                device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                start = GetMSTime();
                initialAudioLevel = device.AudioEndpointVolume.MasterVolumeLevelScalar;

                while (true)
                {
                    double elapsed = (GetMSTime() - start)/1000;
                    double temporalVolume = (1.3+Math.Sin(elapsed*periodAdjust))/2.6;

                    device.AudioEndpointVolume.MasterVolumeLevelScalar = ((float)temporalVolume);
                    Debug.WriteLine("Volume was set to: " + ((float)temporalVolume));
                }
            });

            runner.Start();
        }
示例#16
0
 public Form1()
 {
     InitializeComponent();
     
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     this.Location = Properties.Settings.Default.location;
     this.TopMost = Properties.Settings.Default.TopMost;
     if (Properties.Settings.Default.variablevalue == true)
     {
         allowVariableMaxValueToolStripMenuItem.Checked = true;
         int zero = 1;
         lblMax.Text = zero.ToString();
         resetMaxValueToolStripMenuItem.Enabled = true;
     }
     else
     {
         allowVariableMaxValueToolStripMenuItem.Checked = false;
         int zero = 100;
         lblMax.Text = zero.ToString();
         resetMaxValueToolStripMenuItem.Enabled = false;
     }
     ChangeFontColors();
 }
示例#17
0
        /*
         * Makes a Win32 API call to start listening for window title changes in Spotify. Returns true if we got a successful hook.
         */
        public Boolean startListening()
        {
            MMDeviceEnumerator devEnum = new MMDeviceEnumerator(); // get multimedia device enumerator.
            defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); // grab our default sound device
            procDelegate = new WinEventDelegate(WinEventProc);

            Process[] procs = Process.GetProcessesByName("spotify"); // find the spotify process by name.
            if (procs.Length > 0)
            {
                addLog("Found spotify proc.");
                spotProc = procs[0]; // in the case of multiple spotify processes, just use the first one.
                // Listen for window title changes in the spotify process, using spotify's pid
                spotHook = SetWinEventHook(EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_NAMECHANGE, IntPtr.Zero,
                        procDelegate, (uint)spotProc.Id, 0, WINEVENT_OUTOFCONTEXT);

                if (spotHook != null)
                {
                    addLog("Spotify hook successful. Started.");
                    isRunning = true;
                    checkCurrentSong();

                    return true;
                }
                else
                {
                    addLog("ERROR: bad return value from SetWinEventHook(). Abort.");
                }
            }
            return false;
        }
        /// <summary>
        /// Set the volume of the device.
        /// </summary>
        /// <param name="eDataFlow"></param>
        /// <param name="volume"></param>
        /// <returns></returns>
        private int setDeviceVolume(MMDevice device, int volume)
        {
            // Enforce volume range.
            if (volume > 100)
            {
                volume = 100;
            }
            else if (volume < 0)
            {
                volume = 0;
            }

            device.AudioEndpointVolume.MasterVolumeLevelScalar = ((float)volume / 100);
            return (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
        }
 /// <summary>
 /// Toggles mutes for the specified device.
 /// </summary>
 /// <param name="device"></param>
 /// <returns></returns>
 private bool toggleDeviceMute(MMDevice device)
 {
     device.AudioEndpointVolume.Mute = !device.AudioEndpointVolume.Mute;
     return device.AudioEndpointVolume.Mute;
 }
示例#20
0
 public OsInterface()
 {
     devEnum = new MMDeviceEnumerator();
     defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
 }
示例#21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //COM3
            System.ComponentModel.IContainer components = new System.ComponentModel.Container();
            serialPort1 = new System.IO.Ports.SerialPort(components);
            serialPort1.PortName = "COM3";
            serialPort1.BaudRate = 9600;

            serialPort1.Open();
            if (!serialPort1.IsOpen)
            {
                MessageBox.Show("Oops");
            }

            //Audio
            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
            device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            tbMaster = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
            device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
            //System.ComponentModel.IContainer components = new System.ComponentModel.Container();
        }
示例#22
0
 //Default Constructor
 static VolumeManager()
 {
     //Get the master volume device
     systemVolume = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
 }
示例#23
0
        private void formSysMeters_Load(object sender, EventArgs e)
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);

            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
            audioDevice = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

            //check for updates
            Updater.Update(VERSION, UPDATE_URL);
        }
示例#24
0
 public Speaker(MMDevice device, AudioEndPointVolumeVolumeRange volumeRange, float normalVolume)
 {
     Device = device;
     VolumeRange = volumeRange;
     NormalVolume = normalVolume;
 }
 public AudioDevice(int Index, MMDevice BaseDevice)
 {
     this.Index = Index;
     this.DeviceFriendlyname = BaseDevice.FriendlyName;
     this.Device = BaseDevice;
 }
示例#26
0
 private static void UpdateVolumn()
 {
     float volumn = float.Parse(INIFILE.GetValue("MAIN", "SystemVolumn"));
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     device.AudioEndpointVolume.MasterVolumeLevelScalar = (volumn / 100.0f);
 }
示例#27
0
 public void run()
 {
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
 }
示例#28
0
        // This will start listening for changes in master volume (and assign a delegate to be notified when there is a change)
        public static void InitMasterVolumeListener(OnMasterVolumeChangeDelegate onMasterVolumeChange)
        {
            EndMasterVolumeListener();

            _onMasterVolumeChangeDelegate = onMasterVolumeChange;

            MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
            _deviceForMasterVolume = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
            _deviceForMasterVolume.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(_onMasterVolumeChange);

            // Set initial master volume
            if (onMasterVolumeChange != null)
                onMasterVolumeChange(_deviceForMasterVolume.AudioEndpointVolume.MasterVolumeLevelScalar, _deviceForMasterVolume.AudioEndpointVolume.Mute);
        }
示例#29
0
        void SettingStage_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {

                Loaded -= SettingStage_Loaded;
                //TvmUpdate update = new TvmUpdate("ice", "pc", false, "3.5.0.5");
                string Product1 = Utility.INIFILE.GetValue("MAIN", "Product");
                string Device1 = Utility.INIFILE.GetValue("MAIN", "Device");
                string version1 = Utility.INIFILE.GetValue("MAIN", "version");

                //TimeZoneInfo
                //string xx = File.ReadAllText(Meetingpath, UnicodeEncoding.GetEncoding("GB2312"));

                //if (!File.Exists(Meetingpath))
                //{
                //    Console.WriteLine(Meetingpath + " 找不到...");
                //    return;
                //}

                //string xx = File.ReadAllText(Meetingpath, UnicodeEncoding.UTF8);
                //meetingName.Text = xx;
                currentVersion.Text = "版本号:" + version1;
                update = new TvmUpdate(Product1, Device1, false, version1);
                Warning = this.FindName("warningPlate") as WarningPlate;
                PopGrid = this.FindName("popGrid") as Grid;
                Stage = this;
                this._scale1.ScaleX = SystemParameters.PrimaryScreenWidth / 1920d;
                this._scale1.ScaleY = SystemParameters.PrimaryScreenHeight / 1080d;
                MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
                device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                _volume.ValueChanged += Slider_ValueChanged;
                _volume.Value = (int)(device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
                device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);

                dtTimer.Tick += dt_Tick;
                dtTimer.Start();

                resolutionUIGrid.Width = resolutionUIGrid.ActualWidth;
                resolutionUIGrid.Height = resolutionUIGrid.ActualHeight;
                handle = (IntPtr)new WindowInteropHelper(App.Current.MainWindow).Handle.ToInt32();
                ListObject.Add(_volume);//0
                ListObject.Add(internetTime);//1

                ListObject.Add(_year);//2
                ListObject.Add(_month);//3
                ListObject.Add(_day);//4
                ListObject.Add(_hour);//5
                ListObject.Add(_minute);//6
                ListObject.Add(_second);//7

                ListObject.Add(meetingName);//8
                ListObject.Add(updateBox);//9
                ListObject.Add(appDesc);//10

                ListObject.Add(myLawText);//11

                ListObject.Add(resolutionUIGrid);//12
                ListObject.Add(timeZone);//13
                InitializeSelectedBorder();//

                DispatcherTimer dtUpdate = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(5) };
                dtUpdate.Tick += delegate
                {
                    dtUpdate.Stop();
                    CheckVersion();
                };
                dtUpdate.Start();
                Utility.DeleteFolder(Directory.GetCurrentDirectory() + "\\ICEPatch\\");
                CreateLog();
                resolutionUI.UpdateResolution += resolutionUI_UpdateResolution;

                GetSystemTimeZone();
            }
            catch { }
        }
示例#30
-1
 public MainForm()
 {
     InitializeComponent();
     MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
     _device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
     tbMaster.Value = (int)(_device.AudioEndpointVolume.MasterVolumeLevelScalar * 100);
     _device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
     syncLevelTimer.Enabled = true;
 }