Exemplo n.º 1
0
 private void _OnBroadcastStateChanged(Broadcast.Broadcast.EState state, string deviceName)
 {
     Current.Dispatcher.BeginInvoke(new Action(() =>
     {
         string icon             = "snapcast";
         TaskbarIcon.ToolTipText = $"Snap.Net {Version.Major}.{Version.Minor}.{Version.Build}";
         if (state.HasFlag(SnapDotNet.Broadcast.Broadcast.EState.Connected))
         {
             bool capturing = state.HasFlag(SnapDotNet.Broadcast.Broadcast.EState.Capturing);
             if (capturing)
             {
                 icon = "snapcast_r";
                 TaskbarIcon.ToolTipText = $"Broadcasting audio from device {deviceName}";
             }
             else
             {
                 TaskbarIcon.ToolTipText = $"Not broadcasting, waiting for audio from device:\n{deviceName}";
             }
         }
         TaskbarIcon.IconSource =
             BitmapFrame.Create(new Uri($"pack://application:,,,/Snap.Net;component/Assets/{icon}.ico"));
     }));
 }
Exemplo n.º 2
0
        private void _OnBroadcastStateChanged(Broadcast.Broadcast.EState state, string deviceName)
        {
            m_DeviceName = deviceName;
            Application.Current.Dispatcher.Invoke(() =>
            {
                imgIcon.Kind   = MahApps.Metro.IconPacks.PackIconBoxIconsKind.RegularBroadcast;
                bool connected = state.HasFlag(Broadcast.Broadcast.EState.Connected);
                if (connected == false)
                {
                    imgIcon.Kind = PackIconBoxIconsKind.RegularBlock;
                }

                btRecord.IsChecked = connected;
            });
            Console.WriteLine(state);
        }