public void OnDefaultDeviceChanged(DataFlow dataFlow, Role role, string defaultDeviceId)
 {
     Console.WriteLine($"Default playback device changed to {dataFlow.ToString()}");
     MaybeClearVolumeNotificationListener();
     currentDefaultDevice = mMDeviceEnumerator.GetDevice(defaultDeviceId);
     MaybeSetupVolumeNotificationListener();
 }
Exemple #2
0
 public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId)
 {
     if (flow == DataFlow.Render && role == Role.Multimedia)
     {
         _defaultDevice.AudioEndpointVolume.OnVolumeNotification -= AudioEndpointVolume_OnVolumeNotification;
         _defaultDevice = _enumerator.GetDevice(defaultDeviceId);
         _defaultDevice.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
     }
     Console.WriteLine($"Default device changed to: {defaultDeviceId} {flow.ToString()} {role.ToString()}");
 }
Exemple #3
0
        static void Main(string[] args)
        {
            //Read in csv file(s) or a .dprep package.
            string FMInfoPath     = Path.Combine(Directory.GetCurrentDirectory(), "farmers-markets-info.csv");
            string FMProductsPath = Path.Combine(Directory.GetCurrentDirectory(), "farmers-markets-products.csv");
            string resultPath     = Path.Combine(Directory.GetCurrentDirectory(), "result.csv");

            DataFlow dataFlowMarketInfo = Reader.AutoReadFile(FMInfoPath);
            DataFlow dataFlowProducts   = Reader.AutoReadFile(FMProductsPath);

            //Select useful columns.
            dataFlowMarketInfo = dataFlowMarketInfo.KeepColumns(
                columnNames: new string[] { "FMID", "MarketName", "State", "zip", "Location" });
            dataFlowProducts = dataFlowProducts.KeepColumns(
                columnNames: new string[] { "Credit", "Organic", "Flowers" });

            //Column type conversions: ToBool, ToLong, ToNumber, ToString, ToDateTime.
            dataFlowMarketInfo = dataFlowMarketInfo.ToString(columnName: "FMID");
            dataFlowProducts   = dataFlowProducts.ToBool(
                columnName: "Organic",
                trueValues: new List <string> {
                "Y"
            },
                falseValues: new List <string> {
                "N"
            },
                mismatchAs: MismatchAsOption.AsFalse);

            //Replace values to null values.
            dataFlowMarketInfo = dataFlowMarketInfo.ReplaceNa(
                columnName: "Location",
                customNaList: "Other");
            dataFlowMarketInfo = dataFlowMarketInfo.ReplaceNa(columnName: "zip");

            //Append columns from one dataflow to the other.
            DataFlow dataFlowCombined = dataFlowMarketInfo.AppendColumns(
                dataflows: new List <DataFlow> {
                dataFlowProducts
            });

            //Sort values in selected column.
            List <Tuple <string, bool> > sortOrder = new List <Tuple <string, bool> >
            {
                new Tuple <string, bool>("State", false)
            };

            dataFlowCombined = dataFlowCombined.Sort(sortOrder);

            //Write output to a csv file or save to .dprep package.
            DataFlow result = dataFlowCombined.WriteDelimitedFile(resultPath);

            // Get a IDataView object for further model training, such as ML.Net
            IDataView dataView = result.ToDataView();
        }
        public void DeleteFlow(DataFlow instance, NodeVisit visit)
        {
            ValidateCanEditFlowById(visit, instance.Id);

            TransactionTemplate.Execute(delegate
            {
                _flowDao.Delete(instance);
                ActivityManager.LogAudit(NodeMethod.None, instance.FlowName, visit, "{0} deleted data flow: {1}.",
                                         visit.Account.NaasAccount, instance.ToString());
                return(null);
            });
        }
Exemple #5
0
 public void OnDefaultDeviceChanged(DataFlow dataFlow, Role role, string defaultDeviceId)
 {
     Console.WriteLine("OnDefaultDeviceChanged --> {0}", dataFlow.ToString());
     Console.WriteLine("Default Device ID is: {0}", defaultDeviceId);
     if (defaultDeviceId == this.monitorDeviceId)
     {
         Console.WriteLine("Monitor State Change!");
         var deviceEnumerator = new MMDeviceEnumerator();
         var device           = deviceEnumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
         device.AudioEndpointVolume.Mute = true;
     }
 }
        public DataFlow SaveFlow(DataFlow instance, NodeVisit visit)
        {
            ValidateCanEditFlowById(visit, instance.Id);

            if ((instance == null))
            {
                throw new ArgumentException("Input values are null.");
            }

            instance.ModifiedById = visit.Account.Id;
            TransactionTemplate.Execute(delegate
            {
                _flowDao.Save(instance);
                ActivityManager.LogAudit(NodeMethod.None, instance.FlowName, visit, "{0} saved flow: {1}.",
                                         visit.Account.NaasAccount, instance.ToString());
                return(null);
            });
            return(instance);
        }
Exemple #7
0
 public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId)
 {
     CacheList = null;
     InnerLogger.Info("OnDefaultDeviceChanged --> {0}", flow.ToString());
 }
 public void OnDefaultDeviceChanged(DataFlow dataFlow, Role deviceRole, string defaultDeviceId)
 {
     //Do some Work
     Console.WriteLine("OnDefaultDeviceChanged --> {0}", dataFlow.ToString());
 }
Exemple #9
0
 public void OnDefaultDeviceChanged(DataFlow dataFlow, Role deviceRole, string defaultDeviceId)
 {
     //Do some Work
     soundPlayer.StartDeviceUpdateTimer();
     Console.WriteLine("OnDefaultDeviceChanged --> {0}", dataFlow.ToString());
 }