/// <summary> /// Initializes a new instance of the <see cref="ManagementApiClient"/> class. /// </summary> /// <param name="token">The token.</param> /// <param name="baseUri">The base URI.</param> /// <param name="diagnostics">The diagnostics.</param> /// <param name="handler">The <see cref="HttpMessageHandler"/> which is used for HTTP requests</param> public ManagementApiClient(string token, Uri baseUri, DiagnosticsHeader diagnostics, HttpMessageHandler handler) { // If no diagnostics header structure was specified, then revert to the default one if (diagnostics == null) { diagnostics = DiagnosticsHeader.Default; } apiConnection = new ApiConnection(token, baseUri.AbsoluteUri, diagnostics, handler); BlacklistedTokens = new BlacklistedTokensClient(apiConnection); ClientGrants = new ClientGrantsClient(apiConnection); Clients = new ClientsClient(apiConnection); Connections = new ConnectionsClient(apiConnection); DeviceCredentials = new DeviceCredentialsClient(apiConnection); EmailProvider = new EmailProviderClient(apiConnection); Jobs = new JobsClient(apiConnection); Logs = new LogsClient(apiConnection); ResourceServers = new ResourceServersClient(apiConnection); Rules = new RulesClient(apiConnection); Stats = new StatsClient(apiConnection); TenantSettings = new TentantSettingsClient(apiConnection); Tickets = new TicketsClient(apiConnection); UserBlocks = new UserBlocksClient(apiConnection); Users = new UsersClient(apiConnection); }
private async void Button_Click(object sender, RoutedEventArgs e) { DateTime date = ((DatePicker)CommonHelper.FindChildControl <DatePicker>(this, "EntranceDatePicker")).Date.Date.AddHours(((TimePicker)CommonHelper.FindChildControl <TimePicker>(this, "EntranceTimePicker")).Time.Hours); int people = Int32.Parse(((TextBox)CommonHelper.FindChildControl <TextBox>(this, "NumberOfPeople")).Text); Entrance entrance = new Entrance(date, people, ((Button)sender).Name == "InButton" ? true : false); StatsClient client = new StatsClient(); await client.PostEntrance(entrance); ((Grid)CommonHelper.FindChildControl <Grid>(this, "AddForm")).Visibility = Visibility.Collapsed; ((StackPanel)CommonHelper.FindChildControl <StackPanel>(this, "PostAdd")).Visibility = Visibility.Visible; var entrances = await client.GetEntrances(); this.DefaultViewModel["Entrances"] = entrances; List <EntrancesByDay> entracesPerDay = new List <EntrancesByDay>(); var saturday = await client.GetEntrancesByDay("saturday"); var sunday = await client.GetEntrancesByDay("sunday"); entracesPerDay.Add(new EntrancesByDay("saturday", saturday)); entracesPerDay.Add(new EntrancesByDay("sunday", sunday)); System.Diagnostics.Debug.WriteLine("entracesPerDay"); System.Diagnostics.Debug.WriteLine(entracesPerDay); this.DefaultViewModel["EntrancesPerDay"] = entracesPerDay; this.UpdateLayout(); }
/// <summary> /// Initializes a new instance of the <see cref="ManagementApiClient"/> class. /// </summary> /// <param name="token">A valid Auth0 Management API v2 token.</param> /// <param name="baseUri"><see cref="Uri"/> of the tenant to manage.</param> /// <param name="managementConnection"><see cref="IManagementConnection"/> to facilitate communication with server.</param> public ManagementApiClient(string token, Uri baseUri, IManagementConnection managementConnection = null) { if (managementConnection == null) { var ownedManagementConnection = new HttpClientManagementConnection(); managementConnection = ownedManagementConnection; connectionToDispose = ownedManagementConnection; } var defaultHeaders = CreateDefaultHeaders(token); BlacklistedTokens = new BlacklistedTokensClient(managementConnection, baseUri, defaultHeaders); ClientGrants = new ClientGrantsClient(managementConnection, baseUri, defaultHeaders); Clients = new ClientsClient(managementConnection, baseUri, defaultHeaders); Connections = new ConnectionsClient(managementConnection, baseUri, defaultHeaders); CustomDomains = new CustomDomainsClient(managementConnection, baseUri, defaultHeaders); DeviceCredentials = new DeviceCredentialsClient(managementConnection, baseUri, defaultHeaders); EmailProvider = new EmailProviderClient(managementConnection, baseUri, defaultHeaders); EmailTemplates = new EmailTemplatesClient(managementConnection, baseUri, defaultHeaders); Guardian = new GuardianClient(managementConnection, baseUri, defaultHeaders); Jobs = new JobsClient(managementConnection, baseUri, defaultHeaders); Logs = new LogsClient(managementConnection, baseUri, defaultHeaders); ResourceServers = new ResourceServersClient(managementConnection, baseUri, defaultHeaders); Roles = new RolesClient(managementConnection, baseUri, defaultHeaders); Rules = new RulesClient(managementConnection, baseUri, defaultHeaders); Stats = new StatsClient(managementConnection, baseUri, defaultHeaders); TenantSettings = new TenantSettingsClient(managementConnection, baseUri, defaultHeaders); Tickets = new TicketsClient(managementConnection, baseUri, defaultHeaders); UserBlocks = new UserBlocksClient(managementConnection, baseUri, defaultHeaders); Users = new UsersClient(managementConnection, baseUri, defaultHeaders); }
private static void StoreConsent(MyGuiScreenMessageBox.ResultEnum confirmationResult, bool consent, Action continuation) { if (confirmationResult != MyGuiScreenMessageBox.ResultEnum.YES) { return; } if (ConsentRequested && consent == ConsentGiven) { continuation?.Invoke(); return; } if (!StatsClient.Consent(consent)) { LogFile.WriteLine("Failed to register player consent on statistics server"); return; } var config = Main.Instance.Config; config.DataHandlingConsentDate = Tools.Tools.FormatDateIso8601(DateTime.Today); config.DataHandlingConsent = consent; config.Save(); if (consent) { StatsClient.Track(Main.Instance.TrackablePluginIds); } OnConsentChanged?.Invoke(); continuation?.Invoke(); }
public void NewEmail() { //MasterConfiguration.MConfiguration.SetConfigurationName("ConfigurationTest.config"); var builder = new ContainerBuilder(); //builder.RegisterModule<CalculateEmails.Service.Autofac>(); //builder.RegisterModule<CalculateEmails.ServiceClient.AutofacModule>(); builder.RegisterType <StatsClient>().As <IStatsClient>(); builder.RegisterType <DateTimePT.DateTimeTools>().As <DateTimePT.IDateTimeTools>(); builder.RegisterModule <CalculateEmails.Service.Autofac>(); builder.RegisterType <Configuration>().As <IConfig>(); AutofacContainer.Container = builder.Build(); PSCalculateEmails calculateEmails = new PSCalculateEmails(); calculateEmails.OnTest(); ProcessingClient client = new ProcessingClient(); client.ProcessOutlookMail(CalculateEmails.Contract.DataContract.InboxType.Main, CalculateEmails.Contract.DataContract.EmailActionType.Added); StatsClient onlineClient = new StatsClient(); var stats = onlineClient.GetCalculationDay(); Assert.AreEqual(1, stats.MailCountAdd); }
private void InitializeApiClients() { DomainsClient = new DomainsClient(httpClient, "domains"); MessagesClient = new MessagesClient(httpClient, "domains"); RulesClient = new RulesClient(httpClient, "domains"); StatsClient = new StatsClient(httpClient, "team"); }
private async void AppBarButton_Click(object sender, RoutedEventArgs e) { DateTime date = EntranceDatePicker.Date.Date.AddHours(EntranceTimePicker.Time.Hours); int people = Int32.Parse(NumberOfPeople.Text); Entrance entrance = new Entrance(date, people, ((AppBarButton)sender).Name == "GoButton" ? true : false); StatsClient client = new StatsClient(); await client.PostEntrance(entrance); Frame.GoBack(); }
private CalculationDay GetCalculationDayDetails() { if (ServiceIsWorking) { StatsClient onlineClient = new StatsClient(); CalculationDay calculationDay = onlineClient.GetCalculationDay(); return calculationDay; } else { return new CalculationDay(); } }
public profileViewModel(IUserData userdata, IEventAggregator events, ISocketHandler socketHandler) { _userData = userdata; _events = events; _events.Subscribe(this); _socketHandler = socketHandler; this.statsClient = JsonConvert.DeserializeObject <StatsClient>(this._socketHandler.TestGETWebRequest("/profile/stats/" + this._userData.userName).ToString()); _avatars = new BindableCollection <Avatar>(); fillAvatars(); nbAvatars = _avatars.Count(); _selectedAvatarIndex = 0; _initialPP = JsonConvert.DeserializeObject <PrivateProfile>(socketHandler.TestGETWebRequest("/profile/private/" + userdata.userName).ToString()); _newlPP = new PrivateProfile(_initialPP.firstname, _initialPP.firstname, _initialPP.lastname, _initialPP.password, _initialPP.avatar); }
private void ReportEnabledPlugins() { if (!PlayerConsent.ConsentGiven) { return; } Splash.SetText("Reporting plugin usage..."); LogFile.WriteLine("Reporting plugin usage"); // Config has already been validated at this point so all enabled plugins will have list items // FIXME: Move into a background thread if (StatsClient.Track(TrackablePluginIds)) { LogFile.WriteLine("List of enabled plugins has been sent to the statistics server"); } else { LogFile.WriteLine("Failed to send the list of enabled plugins to the statistics server"); } }
private ManagementApiClient(string token, Uri baseUri, DiagnosticsHeader diagnostics, ApiConnection apiConnection) { _apiConnection = apiConnection; BlacklistedTokens = new BlacklistedTokensClient(_apiConnection); ClientGrants = new ClientGrantsClient(_apiConnection); Clients = new ClientsClient(_apiConnection); Connections = new ConnectionsClient(_apiConnection); DeviceCredentials = new DeviceCredentialsClient(_apiConnection); EmailProvider = new EmailProviderClient(_apiConnection); EmailTemplates = new EmailTemplatesClient(_apiConnection); Jobs = new JobsClient(_apiConnection); Logs = new LogsClient(_apiConnection); ResourceServers = new ResourceServersClient(_apiConnection); Rules = new RulesClient(_apiConnection); Stats = new StatsClient(_apiConnection); TenantSettings = new TenantSettingsClient(_apiConnection); Tickets = new TicketsClient(_apiConnection); UserBlocks = new UserBlocksClient(_apiConnection); Users = new UsersClient(_apiConnection); }
private ManagementApiClient(ApiConnection apiConnection) { _apiConnection = apiConnection; BlacklistedTokens = new BlacklistedTokensClient(_apiConnection); ClientGrants = new ClientGrantsClient(_apiConnection); Clients = new ClientsClient(_apiConnection); Connections = new ConnectionsClient(_apiConnection); CustomDomains = new CustomDomainsClient(_apiConnection); DeviceCredentials = new DeviceCredentialsClient(_apiConnection); EmailProvider = new EmailProviderClient(_apiConnection); EmailTemplates = new EmailTemplatesClient(_apiConnection); Guardian = new GuardianClient(_apiConnection); Jobs = new JobsClient(_apiConnection); Logs = new LogsClient(_apiConnection); ResourceServers = new ResourceServersClient(_apiConnection); Roles = new RolesClient(_apiConnection); Rules = new RulesClient(_apiConnection); Stats = new StatsClient(_apiConnection); TenantSettings = new TenantSettingsClient(_apiConnection); Tickets = new TicketsClient(_apiConnection); UserBlocks = new UserBlocksClient(_apiConnection); Users = new UsersClient(_apiConnection); }
public AccountInfoController(StatsClient client) { _client = client; }
public AccountSeasonalStatsController(StatsClient client) { _client = client; }
public AccountLevelController(StatsClient client) { _client = client; }
public Main() { Stopwatch sw = Stopwatch.StartNew(); Splash = new SplashScreen(); Instance = this; Cursor temp = Cursor.Current; Cursor.Current = Cursors.AppStarting; string pluginsDir = LoaderTools.PluginsDir; Directory.CreateDirectory(pluginsDir); LogFile.Init(pluginsDir); LogFile.WriteLine("Starting - v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(3)); // Fix tls 1.2 not supported on Windows 7 - github.com is tls 1.2 only try { ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; } catch (NotSupportedException e) { LogFile.WriteLine("An error occurred while setting up networking, web requests will probably fail: " + e); } Splash.SetText("Finding references..."); RoslynReferences.GenerateAssemblyList(); AppDomain.CurrentDomain.AssemblyResolve += ResolveDependencies; Config = PluginConfig.Load(pluginsDir); List = new PluginList(pluginsDir, Config); Config.Init(List); StatsClient.OverrideBaseUrl(Config.StatsServerBaseUrl); Splash.SetText("Patching..."); LogFile.WriteLine("Patching"); // Check harmony version Version expectedHarmony = new Version(HarmonyVersion); Version actualHarmony = typeof(Harmony).Assembly.GetName().Version; if (expectedHarmony != actualHarmony) { LogFile.WriteLine($"WARNING: Unexpected Harmony version, plugins may be unstable. Expected {expectedHarmony} but found {actualHarmony}"); } new Harmony("avaness.PluginLoader").PatchAll(Assembly.GetExecutingAssembly()); Splash.SetText("Instantiating plugins..."); LogFile.WriteLine("Instantiating plugins"); foreach (string id in Config) { PluginData data = List[id]; if (data is GitHubPlugin github) { github.Init(pluginsDir); } if (PluginInstance.TryGet(data, out PluginInstance p)) { plugins.Add(p); if (data.IsLocal) { HasLocal = true; } } } sw.Stop(); // FIXME: It can potentially run in the background speeding up the game's startup ReportEnabledPlugins(); LogFile.WriteLine($"Finished startup. Took {sw.ElapsedMilliseconds}ms"); Cursor.Current = temp; Splash.Delete(); Splash = null; }