-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init
- Loading branch information
Showing
283 changed files
with
369,474 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+69.5 KB
...mpleClient/UsageDownloadRestfulSampleClient/.vs/UsageDownloadRestfulSampleClient/v16/.suo
Binary file not shown.
48 changes: 48 additions & 0 deletions
48
UsageDownloadRestfulSampleClient/UsageDownloadRestfulSampleClient/App.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/> | ||
</startup> | ||
<appSettings> | ||
<add key="UsageReportAPIUrl" value="https://ea.azure.cn/rest/{0}/usage-report"/> | ||
<add key="UsageReportListAPIUrl" value="https://ea.azure.cn/rest/{0}/usage-reports"/> | ||
<add key="PaginatedUsageReportAPIUrl" value="https://ea.azure.cn/rest/{0}/usage-report/paginated"/> | ||
|
||
<!--<add key="UsageReportAPIUrl" value="https://stage.ea.azure.com/rest/{0}/usage-report" /> | ||
<add key="UsageReportListAPIUrl" value="https://stage.ea.azure.com/rest/{0}/usage-reports"/>--> | ||
|
||
<!--<add key="UsageReportAPIUrl" value="https://waepdev.cloudapp.net/{0}/usage-report" /> | ||
<add key="UsageReportListAPIUrl" value="https://waepdev.cloudapp.net/{0}/usage-reports"/>--> | ||
|
||
<add key="TestKey" value="https://automaticbillingspec.blob.core.windows.net/spec/TestEnrollmentUsageApiKey.txt"/> | ||
|
||
</appSettings> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0"/> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603"/> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral"/> | ||
<bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603"/> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
643 changes: 643 additions & 0 deletions
643
UsageDownloadRestfulSampleClient/UsageDownloadRestfulSampleClient/Form1.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
171 changes: 171 additions & 0 deletions
171
UsageDownloadRestfulSampleClient/UsageDownloadRestfulSampleClient/Form1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Deployment.Application; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using Newtonsoft.Json; | ||
|
||
namespace UsageDownloadRestfulSampleClient | ||
{ | ||
public partial class Form1 : Form | ||
{ | ||
private UsageDownloadHelper downloadHlHelper = new UsageDownloadHelper(); | ||
|
||
public Form1() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void button1_Click(object sender, EventArgs e) | ||
{ | ||
ValidateInputForUsageList(); | ||
string json = downloadHlHelper.GetEnrollmentUsageList(enrollmentTx.Text, accessKeyTx.Text); | ||
usageListJsonTx.Text = json; | ||
} | ||
|
||
byte[] reportBytes; | ||
private void btnSendRequest_Click(object sender, EventArgs e) | ||
{ | ||
ValidateInputForUsageMonth(); | ||
UsageReportType type = (UsageReportType)reportTypeCB.SelectedIndex; | ||
string json = downloadHlHelper.GetEnrollmentUsageByMonth(monthCalendar.SelectionEnd, type, enrollmentMonthTx.Text, accessKeyMonthTx.Text, formatCB.Text); | ||
reportBytes = Encoding.Default.GetBytes(json); | ||
jsonMonthTx.Text = json; | ||
} | ||
|
||
private void btnStreamDownload_Click(object sender, EventArgs e) | ||
{ | ||
ValidateInputForUsageMonth(); | ||
UsageReportType type = (UsageReportType)reportTypeCB.SelectedIndex; | ||
string json = downloadHlHelper.GetEnrollmentUsageByMonthStream(monthCalendar.SelectionEnd, type, enrollmentMonthTx.Text, accessKeyMonthTx.Text, formatCB.Text); | ||
reportBytes = Encoding.Default.GetBytes(json); | ||
jsonMonthTx.Text = json; | ||
} | ||
|
||
private void btnSaveReport_Click(object sender, EventArgs e) | ||
{ | ||
|
||
string json = jsonMonthTx.Text; | ||
|
||
//UsageReportApiResponse response = JsonConvert.DeserializeObject<UsageReportApiResponse>(json); | ||
SaveFileDialog dialog = new SaveFileDialog(); | ||
dialog.AddExtension = true; | ||
dialog.Filter = string.Format("Report files (*.{0})|*.{0}", "csv"); | ||
|
||
if (dialog.ShowDialog() == DialogResult.OK) | ||
{ | ||
File.WriteAllBytes(dialog.FileName, reportBytes); | ||
} | ||
} | ||
|
||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) | ||
{ | ||
GetTestKey(); | ||
} | ||
|
||
private void GetTestKey() | ||
{ | ||
Process.Start(ConfigurationManager.AppSettings["TestKey"]); | ||
} | ||
|
||
#region Private Methods | ||
|
||
private void ValidateInputForUsageList() | ||
{ | ||
|
||
} | ||
|
||
private void ValidateInputForUsageMonth() | ||
{ | ||
|
||
} | ||
|
||
#endregion | ||
|
||
private async void btnRegularDownload_Click(object sender, EventArgs e) | ||
{ | ||
rtbResponseText.Clear(); | ||
|
||
rtbResponseText.Clear(); | ||
Application.EnableVisualStyles(); | ||
label17.Visible = true; | ||
progressBar1.Visible = true; | ||
progressBar1.Style = ProgressBarStyle.Marquee; | ||
progressBar1.MarqueeAnimationSpeed = 30; | ||
btnPaginatedStreamDownload.Enabled = false; | ||
btnRegularDownload.Enabled = false; | ||
|
||
var month = calMonth.SelectionEnd; | ||
var enrNumber = txtEnrNumber.Text; | ||
var txtAcessKey = txtAccessKey.Text; | ||
var fmt = cmbFormat.Text; | ||
var pageindex = int.Parse(txtPageIndex.Text); | ||
string json = string.Empty; | ||
|
||
try | ||
{ | ||
|
||
json = await downloadHlHelper.GetEnrollmentPaginatedUsageByMonth(month, enrNumber, txtAcessKey, fmt, pageindex); | ||
rtbResponseText.Text = json; | ||
} | ||
catch(Exception ex) | ||
{ | ||
rtbResponseText.Text = ex.Message; | ||
} | ||
|
||
progressBar1.Style = ProgressBarStyle.Continuous; | ||
progressBar1.MarqueeAnimationSpeed = 0; | ||
progressBar1.Visible = false; | ||
label17.Visible = false; | ||
btnPaginatedStreamDownload.Enabled = true; | ||
btnRegularDownload.Enabled = true; | ||
|
||
} | ||
|
||
private async void btnPaginatedStreamDownload_Click(object sender, EventArgs e) | ||
{ | ||
rtbResponseText.Clear(); | ||
Application.EnableVisualStyles(); | ||
label17.Visible = true; | ||
progressBar1.Visible = true; | ||
progressBar1.Style = ProgressBarStyle.Marquee; | ||
progressBar1.MarqueeAnimationSpeed = 30; | ||
btnPaginatedStreamDownload.Enabled = false; | ||
btnRegularDownload.Enabled = false; | ||
|
||
var month = calMonth.SelectionEnd; | ||
var enrNumber = txtEnrNumber.Text; | ||
var txtAcessKey = txtAccessKey.Text; | ||
var fmt = cmbFormat.Text; | ||
var pageindex = int.Parse(txtPageIndex.Text); | ||
string json= string.Empty; | ||
await Task.Run(() => | ||
{ | ||
json = downloadHlHelper.GetEnrollmentPaginatedUsageByMonthStream(month, enrNumber, txtAcessKey, fmt, pageindex); | ||
|
||
}); | ||
rtbResponseText.Text = json; | ||
|
||
progressBar1.Style = ProgressBarStyle.Continuous; | ||
progressBar1.MarqueeAnimationSpeed = 0; | ||
progressBar1.Visible = false; | ||
label17.Visible = false; | ||
btnPaginatedStreamDownload.Enabled = true; | ||
btnRegularDownload.Enabled = true; | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
UsageDownloadRestfulSampleClient/UsageDownloadRestfulSampleClient/Form1.resx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<!-- | ||
Microsoft ResX Schema | ||
Version 2.0 | ||
The primary goals of this format is to allow a simple XML format | ||
that is mostly human readable. The generation and parsing of the | ||
various data types are done through the TypeConverter classes | ||
associated with the data types. | ||
Example: | ||
... ado.net/XML headers & schema ... | ||
<resheader name="resmimetype">text/microsoft-resx</resheader> | ||
<resheader name="version">2.0</resheader> | ||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
<value>[base64 mime encoded serialized .NET Framework object]</value> | ||
</data> | ||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
<comment>This is a comment</comment> | ||
</data> | ||
There are any number of "resheader" rows that contain simple | ||
name/value pairs. | ||
Each data row contains a name, and value. The row also contains a | ||
type or mimetype. Type corresponds to a .NET class that support | ||
text/value conversion through the TypeConverter architecture. | ||
Classes that don't support this are serialized and stored with the | ||
mimetype set. | ||
The mimetype is used for serialized objects, and tells the | ||
ResXResourceReader how to depersist the object. This is currently not | ||
extensible. For a given mimetype the value must be set accordingly: | ||
Note - application/x-microsoft.net.object.binary.base64 is the format | ||
that the ResXResourceWriter will generate, however the reader can | ||
read any of the formats listed below. | ||
mimetype: application/x-microsoft.net.object.binary.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.soap.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
value : The object must be serialized into a byte array | ||
: using a System.ComponentModel.TypeConverter | ||
: and then encoded with base64 encoding. | ||
--> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="metadata"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" use="required" type="xsd:string" /> | ||
<xsd:attribute name="type" type="xsd:string" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="assembly"> | ||
<xsd:complexType> | ||
<xsd:attribute name="alias" type="xsd:string" /> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<data name="accessKeyTx.Text" xml:space="preserve"> | ||
<value>eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlE5WVpaUnA1UVRpMGVPMmNoV19aYmh1QlBpWSJ9.eyJFbnJvbGxtZW50TnVtYmVyIjoiMTAwIiwiSWQiOiJiNWU2OWI2Mi0wOWM2LTRmMjktODdmYi0yMTNmMjVkOGExNTMiLCJSZXBvcnRWaWV3IjoiU3lzdGVtIiwiUGFydG5lcklkIjoiIiwiRGVwYXJ0bWVudElkIjoiIiwiQWNjb3VudElkIjoiIiwiaXNzIjoiZWEubWljcm9zb2Z0YXp1cmUuY29tIiwiYXVkIjoiY2xpZW50LmVhLm1pY3Jvc29mdGF6dXJlLmNvbSIsImV4cCI6MTUwNzgyOTI0OCwibmJmIjoxNDkyMDE4MDQ4fQ.Nng57KGNINNTuf8lZB0u4FjM16tu-mrrzWtNQ6vG4_jIJ_Ad06O0U8ROIdM88rvQMyuUlKU3RE-titGq7QoV0ieioKXFrOJ4HTjeUmYET2loriz8UXozk_e2QTmi_FOn-sDgwMhGMRhg0w85cw1p7m2o_2dBizcEhrus8SNb-Z6Ab4A08g9_V2IS1oNJRnU4lGP91sK2CTpWGJUocsTucqTfrUknWPD1ghDSAqkWfGcTvPFQlg7RwXQpG79PfBf0R4ptETBDBfWO7iFNnhphWrKLSCCQ53oLaffvUmlM5YVqeMUH3W63uNMVMIvi9GMA2NFbZcBH3azooSVZpSNDHw</value> | ||
</data> | ||
</root> |
28 changes: 28 additions & 0 deletions
28
UsageDownloadRestfulSampleClient/UsageDownloadRestfulSampleClient/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace UsageDownloadRestfulSampleClient | ||
{ | ||
static class Program | ||
{ | ||
/// <summary> | ||
/// The main entry point for the application. | ||
/// </summary> | ||
[STAThread] | ||
static void Main() | ||
{ | ||
Application.ThreadException += Application_ThreadException; | ||
Application.EnableVisualStyles(); | ||
Application.SetCompatibleTextRenderingDefault(false); | ||
Application.Run(new Form1()); | ||
} | ||
|
||
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) | ||
{ | ||
MessageBox.Show("Error: " + e.Exception.Message); | ||
} | ||
} | ||
} |
Oops, something went wrong.