public Form1() { InitializeComponent(); _logFile.WriteLine(" -----------------------------------------------------------"); _syncContext = WindowsFormsSynchronizationContext.Current; var context = new InstanceContext(this); _serviceClient = new LocalizationServiceClient(context); _serviceClient.Subscribe(); //Context c =_contextService.GetById("ciao"); //foreach (var networkInterface in c.NetworkInterfaces) //{ // var action = networkInterface.Action; // if(action == NetworkInterfaceActionType.Connect) // { // var profile = networkInterface.ProfileName; // var wlanIface = _wlanClient.Interfaces // .AsQueryable() // .Where(i => i.InterfaceGuid.ToString() == networkInterface.InterfaceGuid) // .SingleOrDefault(); // if(wlanIface == null) // { // // may be removed // continue; // } // wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profile); // } // else if(action == NetworkInterfaceActionType.Disconnect) // { // //... // } //} }
private Status() { CurrentContextId = ""; context = new InstanceContext(this); _serviceClient = new LocalizationServiceClient(context); _serviceClient.Subscribe(); _timer.Elapsed += _timer_Elapsed; }
public FindPage() { InitializeComponent(); var context = new InstanceContext(this); _serviceClient = new LocalizationServiceClient(context); // update in a separated thread to avoid UI freeze ThreadPool.QueueUserWorkItem(new WaitCallback( (object o) => UpdateContextLists() )); _refreshTimer.Elapsed += _refreshTimer_Elapsed; _refreshTimer.Interval = _settings.FindRefreshInterval; _refreshTimer.Enabled = true; _serviceClient.Subscribe(); }