GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Upgrade to ServiceStack v5 and update all UIs to use same code/functi… · ServiceStackApps/HelloMobile@a7f15e1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • .vs
      • Hello/v15/Server/sqlite3
        • storage.ide
      • config
        • applicationhost.config
    • Client.Android
      • Activity1.cs
      • Resources
        • Layout
          • Main.axml
        • Resource.Designer.cs
    • Client.UWP
      • App.xaml.cs
      • App.xaml
      • Assets
        • LockScreenLogo.scale-200.png
        • SplashScreen.scale-200.png
        • Square150x150Logo.scale-200.png
        • Square44x44Logo.scale-200.png
        • Square44x44Logo.targetsize-24_altform-unplated.png
        • StoreLogo.png
        • Wide310x150Logo.scale-200.png
      • Client.UWP.csproj
      • Client.UWP_TemporaryKey.pfx
      • Directory.Build.props
      • MainPage.xaml.cs
      • MainPage.xaml
      • Package.appxmanifest
      • Properties
        • AssemblyInfo.cs
        • Default.rd.xml
    • Client.Wpf
      • MainWindow.xaml.cs
      • MainWindow.xaml
    • Client.iOS
      • Client.iOS.ViewController.cs
      • Client.iOS.ViewController.designer.cs
      • Client.iOS.csproj
      • Client_iOS_ViewController.cs
      • Client_iOS_ViewController.designer.cs
      • MainStoryboard_iPad.storyboard
      • MainStoryboard_iPhone.storyboard
      • Resources
        • LaunchScreen.xib
    • Directory.Build.props
    • Hello.sln
    • HelloMobile.Tests
      • HelloMobile.Tests.csproj
      • packages.config
    • Server.AspNet
      • Global.asax.cs
      • Server.AspNet.csproj
    • Server.Common
      • Server.Common.csproj
      • WebServices.cs
    • Server.HttpListener
      • Program.cs
      • Server.HttpListener.csproj
    • Server.NetCore
      • Program.cs
      • Server.NetCore.csproj
    • ServiceModel
      • Config.cs
      • Directory.build.props
      • SendFile.cs
    • Shared.Client.Stub
      • Shared.Client.Stub.csproj
    • Shared.Client
      • Shared.Client.csproj
      • SharedGateway.cs
    • Tests.Client
      • GatewayTests.cs
      • JwtTasks.cs
      • Tests.Client.csproj

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/.vs/Hello/v15/Server/sqlite3/storage.ide‎

Copy file name to clipboard
4.52 MB
Binary file not shown.
Collapse file

‎src/.vs/config/applicationhost.config‎

Copy file name to clipboardExpand all lines: src/.vs/config/applicationhost.config
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@
168168
<binding protocol="http" bindingInformation="*:2000:127.0.0.1" />
169169
</bindings>
170170
</site>
171+
<site name="Server.AspNet(1)" id="3">
172+
<application path="/" applicationPool="Clr4IntegratedAppPool">
173+
<virtualDirectory path="/" physicalPath="C:\src\Apps\HelloMobile\src\Server.AspNet" />
174+
</application>
175+
<bindings>
176+
<binding protocol="http" bindingInformation="*:2000:localhost" />
177+
</bindings>
178+
</site>
171179
<siteDefaults>
172180
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
173181
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
Collapse file

‎src/Client.Android/Activity1.cs‎

Copy file name to clipboardExpand all lines: src/Client.Android/Activity1.cs
+62-31Lines changed: 62 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.IO;
32
using Android.App;
43
using Android.Widget;
54
using Android.OS;
@@ -12,62 +11,62 @@ namespace Client.Android
1211
[Activity(Label = "Client.Android", MainLauncher = true, Icon = "@drawable/icon")]
1312
public class Activity1 : Activity
1413
{
14+
//10.0.2.2 = loopback
15+
//http://developer.android.com/tools/devices/emulator.html
16+
private const string BaseUrl = "http://10.0.2.2:2000/";
17+
18+
public IServiceClient CreateClient() => new JsonServiceClient(BaseUrl);
19+
1520
protected override void OnCreate(Bundle bundle)
1621
{
1722
base.OnCreate(bundle);
18-
//AndroidPclExportClient.Configure();
1923

2024
// Set our view from the "main" layout resource
2125
SetContentView(Resource.Layout.Main);
2226

2327
var btnSync = FindViewById<Button>(Resource.Id.btnSync);
2428
var btnAsync = FindViewById<Button>(Resource.Id.btnAsync);
25-
var btnAwait = FindViewById<Button>(Resource.Id.btnAwait);
29+
var btnGateway = FindViewById<Button>(Resource.Id.btnGateway);
2630
var btnAuth = FindViewById<Button>(Resource.Id.btnAuth);
27-
var btnShared = FindViewById<Button>(Resource.Id.btnShared);
28-
var txtName = FindViewById<EditText>(Resource.Id.txtName);
31+
var btnJwt = FindViewById<Button>(Resource.Id.btnJwt);
32+
var btnEncrypted = FindViewById<Button>(Resource.Id.btnEncrypted);
2933
var lblResults = FindViewById<TextView>(Resource.Id.lblResults);
3034

31-
//10.0.2.2 = loopback
32-
//http://developer.android.com/tools/devices/emulator.html
33-
var client = new JsonServiceClient("http://10.0.2.2:2000/");
34-
var gateway = new SharedGateway("http://10.0.2.2:2000/");
35-
3635
btnSync.Click += delegate
3736
{
3837
try
3938
{
40-
var response = client.Get(new Hello { Name = txtName.Text });
39+
var client = CreateClient();
40+
var response = client.Get(new Hello { Name = "Sync" });
4141
lblResults.Text = response.Result;
42-
43-
//using (var ms = new MemoryStream("Contents".ToUtf8Bytes()))
44-
//{
45-
// ms.Position = 0;
46-
// var fileResponse = client.PostFileWithRequest<HelloResponse>(
47-
// "/hello", ms, "filename.txt", new Hello { Name = txtName.Text });
48-
49-
// lblResults.Text = fileResponse.Result;
50-
//}
5142
}
5243
catch (Exception ex)
5344
{
5445
lblResults.Text = ex.ToString();
5546
}
5647
};
5748

58-
btnAsync.Click += delegate
49+
btnAsync.Click += async delegate
5950
{
60-
client.GetAsync(new Hello { Name = txtName.Text })
61-
.Success(response => lblResults.Text = response.Result)
62-
.Error(ex => lblResults.Text = ex.ToString());
51+
try
52+
{
53+
var client = CreateClient();
54+
var response = await client.GetAsync(new Hello { Name = "Async" });
55+
lblResults.Text = response.Result;
56+
}
57+
catch (Exception ex)
58+
{
59+
lblResults.Text = ex.ToString();
60+
}
6361
};
6462

65-
btnAwait.Click += async delegate
63+
btnGateway.Click += async delegate
6664
{
6765
try
6866
{
69-
var response = await client.GetAsync(new Hello { Name = txtName.Text });
70-
lblResults.Text = response.Result;
67+
var gateway = new SharedGateway(BaseUrl);
68+
var greeting = await gateway.SayHello("Gateway");
69+
lblResults.Text = greeting;
7170
}
7271
catch (Exception ex)
7372
{
@@ -79,14 +78,15 @@ protected override void OnCreate(Bundle bundle)
7978
{
8079
try
8180
{
81+
var client = CreateClient();
8282
await client.PostAsync(new Authenticate
8383
{
8484
provider = "credentials",
8585
UserName = "user",
8686
Password = "pass",
8787
});
8888

89-
var response = await client.GetAsync(new HelloAuth { Name = "Secure " + txtName.Text });
89+
var response = await client.GetAsync(new HelloAuth { Name = "Auth" });
9090

9191
lblResults.Text = response.Result;
9292
}
@@ -96,12 +96,43 @@ await client.PostAsync(new Authenticate
9696
}
9797
};
9898

99-
btnShared.Click += async delegate
99+
btnJwt.Click += async delegate
100100
{
101101
try
102102
{
103-
var greeting = await gateway.SayHello(txtName.Text);
104-
lblResults.Text = greeting;
103+
var authClient = CreateClient();
104+
var authResponse = await authClient.PostAsync(new Authenticate
105+
{
106+
provider = "credentials",
107+
UserName = "user",
108+
Password = "pass",
109+
});
110+
111+
var client = new JsonServiceClient(BaseUrl)
112+
{
113+
BearerToken = authResponse.BearerToken //JWT
114+
};
115+
116+
var response = await client.GetAsync(new HelloAuth { Name = "JWT Auth" });
117+
118+
lblResults.Text = response.Result;
119+
}
120+
catch (Exception ex)
121+
{
122+
lblResults.Text = ex.ToString();
123+
}
124+
};
125+
126+
btnEncrypted.Click += async delegate
127+
{
128+
try
129+
{
130+
var client = (IJsonServiceClient)CreateClient();
131+
var encryptedClient = client.GetEncryptedClient(Config.PublicKeyXml);
132+
133+
var response = await encryptedClient.SendAsync(new Hello { Name = "Encrypted Client" });
134+
135+
lblResults.Text = response.Result;
105136
}
106137
catch (Exception ex)
107138
{
Collapse file

‎src/Client.Android/Resources/Layout/Main.axml‎

Copy file name to clipboardExpand all lines: src/Client.Android/Resources/Layout/Main.axml
+15-30Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,6 @@
33
android:orientation="vertical"
44
android:layout_width="fill_parent"
55
android:layout_height="fill_parent">
6-
<LinearLayout
7-
android:orientation="horizontal"
8-
android:minWidth="25px"
9-
android:minHeight="25px"
10-
android:layout_width="match_parent"
11-
android:layout_height="wrap_content"
12-
android:id="@+id/linearLayout1">
13-
<TextView
14-
android:text="Name:"
15-
android:layout_width="70.9dp"
16-
android:layout_height="match_parent"
17-
android:id="@+id/lblName"
18-
android:paddingTop="10px"
19-
android:paddingLeft="10px" />
20-
<EditText
21-
android:layout_width="match_parent"
22-
android:layout_height="match_parent"
23-
android:id="@+id/txtName"
24-
android:text="World!"
25-
android:layout_marginRight="0.0dp" />
26-
</LinearLayout>
276
<LinearLayout
287
android:orientation="horizontal"
298
android:minWidth="25px"
@@ -40,16 +19,16 @@
4019
android:layout_marginBottom="0.0dp"
4120
android:layout_marginTop="0.0dp" />
4221
<Button
43-
android:text="Shared"
44-
android:layout_width="85.0dp"
22+
android:text="Async"
23+
android:layout_width="79.0dp"
4524
android:layout_height="match_parent"
46-
android:id="@+id/btnShared"
25+
android:id="@+id/btnAsync"
4726
android:layout_marginLeft="0.0dp" />
4827
<Button
49-
android:text="Await"
50-
android:layout_width="79.0dp"
28+
android:text="Gateway"
29+
android:layout_width="93.0dp"
5130
android:layout_height="match_parent"
52-
android:id="@+id/btnAwait"
31+
android:id="@+id/btnGateway"
5332
android:layout_marginLeft="0.0dp" />
5433
<Button
5534
android:text="Auth"
@@ -58,15 +37,21 @@
5837
android:id="@+id/btnAuth"
5938
android:layout_marginLeft="0.0dp" />
6039
<Button
61-
android:text="Async"
40+
android:text="JWT"
6241
android:layout_width="79.0dp"
6342
android:layout_height="match_parent"
64-
android:id="@+id/btnAsync"
43+
android:id="@+id/btnJwt"
44+
android:layout_marginLeft="0.0dp" />
45+
<Button
46+
android:text="Encrypted"
47+
android:layout_width="106.5dp"
48+
android:layout_height="match_parent"
49+
android:id="@+id/btnEncrypted"
6550
android:layout_marginLeft="0.0dp" />
6651
</LinearLayout>
6752
<TextView
6853
android:layout_width="match_parent"
69-
android:layout_height="327.8dp"
54+
android:layout_height="234.5dp"
7055
android:id="@+id/lblResults"
7156
android:padding="10px"
7257
android:layout_marginBottom="175.6dp" />
Collapse file

‎src/Client.Android/Resources/Resource.Designer.cs‎

Copy file name to clipboardExpand all lines: src/Client.Android/Resources/Resource.Designer.cs
+13-19Lines changed: 13 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎src/Client.UWP/App.xaml‎

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application
2+
x:Class="Client.UWP.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:Client.UWP"
6+
RequestedTheme="Light">
7+
8+
</Application>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.