public static async Task <int> ImportCustomers() { var imp = new QuickBookImportCustomers(); await Task.Run(() => imp.Start()); var list = imp.Customers; if (list.Count == 0) { return(0); } var dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); foreach (var name in list) { dt.Rows.Add(name); } DbObject.ExecStoredProc("ImportAdvertisersFromQb", (cmd) => { cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@advertisers", SqlDbType.Structured) { Value = dt }); }); Advertizer.ReloadAllFromDb(); return(list.Count); }
private void ShowEditAdvertizerWindow(Advertizer a) { var w = new EditAdvertizerWindow(); w.DataContext = new EditAdvertizerViewModel(a); w.ShowDialog(); }
private void RequestConnect(object sender, ConnectionInfo connection) { Advertizer.OutboundReq.Add(connection); connection.InvokeOutboundRequest(); Advertizer.SendRequest(connection); }
public ConnectGame() { InitializeComponent(); Advertizer.ClearConnections(); Advertizer.StartAdvertize(); GameConnection.ListenForGame(); GameConnection.GameConnected += GameConnection_GameConnected; Advertizer.AdvertizersGotten += LoadAdvertizers; Advertizer.NewConnection += (object s, ConnectionInfo e) => { Application.Current.Dispatcher.Invoke(new Action <ConnectionInfo>(AddConnection), e); }; Unloaded += ConnectGame_Unloaded; Advertizer.GetNameAction = new Func <string>(GetPreferedName); }
private void BtnReload_Click(object sender, RoutedEventArgs e) { Advertizer.StartGetAdvertizers(); ConnectionList.IsEnabled = false; BtnReload.IsEnabled = false; }
private void ConnectGame_Unloaded(object sender, RoutedEventArgs e) { Advertizer.StopAdvertize(); Advertizer.AdvertizersGotten -= LoadAdvertizers; GameConnection.StopListening();// this is not needed but used if the connectionListener never stops. }
public EditAdvertizerViewModel(Advertizer ad) { _ad = ad; }
public void RefreshAdvertizers() { Advertizer.ReloadAllFromDb(); RaisePropertyChangedEvent("AllAdvertisers"); }