private void ReportButtonClick(object sender, RoutedEventArgs e) { var userSettings = UnityInstance.Container.Resolve <IUserSettingsProvider>(); var formData = new List <IFormData> { new ErrorReport { Name = "log", ClientId = userSettings.ClientId.ToString(), ApplicationVersion = App.ApplicationVersion, FrameworkVersion = App.FrameworkVersion, OperatingSystemVersion = Environment.OSVersion.VersionString, Details = _details, FtpLog = GetFtpLog() } }; var iw = 0; foreach (Window window in Application.Current.Windows) { formData.Add(new WindowScreenshotReport { Name = "window" + iw, Window = window }); iw++; } HttpForm.Post("report.php", formData); OkButtonClick(sender, e); }
private static string DoPost(NameValueCollection collection) { IHttpForm httpForm = new HttpForm("", 60000, true, 8); HttpFormResponse response = httpForm.Post(new HttpFormPostRequest() { Url = Config.GATE_WAY, FormFields = collection }); return(response.Response); }
/// <summary> /// 设置自定义菜单(包含创建和删除) /// </summary> /// <param name="postData">菜单json数据</param> /// <param name="access_token">凭证</param> /// <returns></returns> private string CreateMenuRequest(string url, string postData, string access_token) { IHttpForm _httpForm = new HttpForm(managerSiteAddr, 1500, true, 8); HttpFormResponse _response = _httpForm.Post(new HttpFormPostRawRequest() { Url = url, Data = postData }); string json = _response.Response.ToString(); return(json); }
protected override void OkButtonClick(object sender, RoutedEventArgs e) { var p = No.IsChecked == true; if (UserSettings.DisableUserStatisticsParticipation != p) { _workHandler.Run(() => HttpForm.Post("clients.php", new List <IFormData> { new RawPostData("client_id", UserSettings.ClientId), new RawPostData("date", DateTime.Now.ToUnixTimestamp()), new RawPostData("participates", p ? "yes" : "no"), })); } UserSettings.DisableUserStatisticsParticipation = p; base.OkButtonClick(sender, e); }
protected override void OnExit(ExitEventArgs e) { if (_bootstrapper != null) { var fileManager = _bootstrapper.Resolve <FileManagerViewModel>(); if (!fileManager.IsDisposed) { fileManager.Dispose(); } var statistics = _bootstrapper.Resolve <StatisticsViewModel>(); if (e.ApplicationExitCode != 0) { statistics.ApplicationCrashed++; } statistics.PersistData(); var userSettings = _bootstrapper.Container.Resolve <IUserSettingsProvider>(); userSettings.PersistData(); //TODO: Better detection if (!Debugger.IsAttached && userSettings.DisableUserStatisticsParticipation != true) { var commandUsage = new StringBuilder(); foreach (var kvp in statistics.CommandUsage) { commandUsage.AppendLine(string.Format("{0}={1}", kvp.Key, kvp.Value)); } var serverUsage = new StringBuilder(); foreach (var kvp in statistics.ServerUsage) { serverUsage.AppendLine(string.Format("{0}={1}", kvp.Key, kvp.Value)); } var utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(statistics.UsageStart); HttpForm.Post("stats.php", new List <IFormData> { new RawPostData("client_id", userSettings.ClientId), new RawPostData("version", ApplicationVersion), new RawPostData("wpf", FrameworkVersion), new RawPostData("os", Environment.OSVersion.VersionString), new RawPostData("culture", CultureInfo.CurrentCulture.Name), new RawPostData("uiculture", CultureInfo.CurrentUICulture.Name), new RawPostData("osculture", CultureInfo.InstalledUICulture.Name), new RawPostData("date", statistics.UsageStart.ToUnixTimestamp()), new RawPostData("timezone", string.Format("{0}{1:D2}:{2:D2}", utcOffset.Hours >= 0 ? "+" : string.Empty, utcOffset.Hours, utcOffset.Minutes)), new RawPostData("usage", Math.Floor(statistics.UsageTime.TotalSeconds)), new RawPostData("exit_code", e.ApplicationExitCode), new RawPostData("games_recognized", statistics.GamesRecognizedFully), new RawPostData("partially_recognized", statistics.GamesRecognizedPartially), new RawPostData("svod_recognized", statistics.SvodPackagesRecognized), new RawPostData("stfs_recognized", statistics.StfsPackagesRecognized), new RawPostData("transferred_bytes", statistics.BytesTransferred), new RawPostData("transferred_files", statistics.FilesTransferred), new RawPostData("transfer_time", Math.Floor(statistics.TimeSpentWithTransfer.TotalSeconds)), new RawPostData("command_usage", commandUsage), new RawPostData("server_usage", serverUsage), new RawPostData("successful_update", statistics.SuccessfulUpdate), new RawPostData("unsuccessful_update", statistics.UnsuccessfulUpdate), }); } } base.OnExit(e); }