some modifications for ClientServerLib
This commit is contained in:
1 parent
ca5fc16332
commit
214cd0f661
17 files changed
+322
-222
No files matched your search
@@ -36,8 +36,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
|
||||
<DefineConstants>MONO</DefineConstants>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -96,4 +96,68 @@
|
||||
<Folder Include="ClientServerLib\Vocaluxe\" />
|
||||
<Folder Include="ClientServerLib\Server\" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
|
||||
<NameConventionPolicy>
|
||||
<Rules>
|
||||
<NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredPrefixes>
|
||||
<String>I</String>
|
||||
</RequiredPrefixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredSuffixes>
|
||||
<String>Attribute</String>
|
||||
</RequiredSuffixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredSuffixes>
|
||||
<String>EventArgs</String>
|
||||
</RequiredSuffixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredSuffixes>
|
||||
<String>Exception</String>
|
||||
</RequiredSuffixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
|
||||
<NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
|
||||
<AllowedPrefixes>
|
||||
<String>_</String>
|
||||
<String>m_</String>
|
||||
</AllowedPrefixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
|
||||
<AllowedPrefixes>
|
||||
<String>_</String>
|
||||
<String>m_</String>
|
||||
</AllowedPrefixes>
|
||||
</NamingRule>
|
||||
<NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Parameters" AffectedEntity="Parameter" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
|
||||
<NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
|
||||
<RequiredPrefixes>
|
||||
<String>T</String>
|
||||
</RequiredPrefixes>
|
||||
</NamingRule>
|
||||
</Rules>
|
||||
</NameConventionPolicy>
|
||||
<VersionControlPolicy inheritsSet="Mono" />
|
||||
<ChangeLogPolicy inheritsSet="Mono" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -16,12 +16,12 @@ using Vocaluxe.Base.Server;
|
||||
|
||||
namespace AndroidRemote
|
||||
{
|
||||
[Activity (Label = "Vocaluxe Remote", MainLauncher = true, ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation)]
|
||||
[Activity (Label = "Vocaluxe App", MainLauncher = true, ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation)]
|
||||
public class Activity1 : Activity
|
||||
{
|
||||
CClient client = new CClient();
|
||||
CDiscover discover;
|
||||
Button bConnect;
|
||||
Button bLogin;
|
||||
Button bSendAvatar;
|
||||
Button bSendProfile;
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace AndroidRemote
|
||||
|
||||
bConnect = FindViewById<Button> (Resource.Id.btConnect);
|
||||
bConnect.Click += delegate { Connect(); };
|
||||
|
||||
bLogin = FindViewById<Button> (Resource.Id.btLogin);
|
||||
bLogin.Click += delegate { Login(); };
|
||||
|
||||
Button bDiscover = FindViewById<Button> (Resource.Id.btDiscover);
|
||||
bDiscover.Click += delegate { Discover(); };
|
||||
|
||||
bSendAvatar = FindViewById<Button> (Resource.Id.btSendAvatar);
|
||||
bSendAvatar.Click += SendAvatar;
|
||||
@@ -62,6 +62,9 @@ namespace AndroidRemote
|
||||
tPassword = FindViewById<TextView> (Resource.Id.tbPassword);
|
||||
|
||||
sendProfile = false;
|
||||
|
||||
discover = new CDiscover(3000, CCommands.BroadcastKeyword);
|
||||
Discover ();
|
||||
}
|
||||
|
||||
protected override void OnStop ()
|
||||
@@ -120,8 +123,8 @@ namespace AndroidRemote
|
||||
return;
|
||||
|
||||
Intent intent = new Intent(MediaStore.ActionImageCapture);
|
||||
dir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), "AndroidRemote");
|
||||
if (dir.Exists())
|
||||
dir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), Resources.GetString(Resource.String.app_name));
|
||||
if (!dir.Exists())
|
||||
{
|
||||
dir.Mkdirs();
|
||||
}
|
||||
@@ -140,10 +143,15 @@ namespace AndroidRemote
|
||||
private void Connect()
|
||||
{
|
||||
if (!client.Connected)
|
||||
client.Connect(tIP.Text, 3000, OnConnectionChanged);
|
||||
client.Connect(tIP.Text, 3000, tPassword.Text, OnConnectionChanged);
|
||||
else
|
||||
client.Disconnect();
|
||||
}
|
||||
|
||||
private void Discover()
|
||||
{
|
||||
discover.Discover (_OnDiscovered);
|
||||
}
|
||||
|
||||
private void Login()
|
||||
{
|
||||
@@ -169,18 +177,6 @@ namespace AndroidRemote
|
||||
int command = BitConverter.ToInt32(Message, 0);
|
||||
switch (command)
|
||||
{
|
||||
case CCommands.ResponseLoginFailed:
|
||||
RunOnUiThread (() => Toast.MakeText(this, Resources.GetString(Resource.String.message_login_failed), ToastLength.Short).Show());
|
||||
break;
|
||||
|
||||
case CCommands.ResponseLoginWrongPassword:
|
||||
RunOnUiThread (() => Toast.MakeText(this, Resources.GetString(Resource.String.message_wrong_password), ToastLength.Short).Show());
|
||||
break;
|
||||
|
||||
case CCommands.ResponseLoginOK:
|
||||
RunOnUiThread (() => UpdateLoginStatus(true));
|
||||
break;
|
||||
|
||||
case CCommands.ResponseOK:
|
||||
RunOnUiThread (() => Toast.MakeText(this, Resources.GetString(Resource.String.message_ok), ToastLength.Short).Show());
|
||||
break;
|
||||
@@ -194,42 +190,36 @@ namespace AndroidRemote
|
||||
}
|
||||
}
|
||||
|
||||
private void _OnDiscovered(string Address, string HostName)
|
||||
{
|
||||
RunOnUiThread (() =>
|
||||
{
|
||||
if (Address != "Timeout")
|
||||
{
|
||||
tIP.Text = Address;
|
||||
Connect ();
|
||||
}
|
||||
else
|
||||
Toast.MakeText(this, "Cant't find any Vocaluxe Server", ToastLength.Short).Show();
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateConnectionStatus(bool Connected)
|
||||
{
|
||||
if (Connected)
|
||||
{
|
||||
bLogin.Enabled = true;
|
||||
bConnect.Text = Resources.GetString(Resource.String.button_disconnect);
|
||||
Toast.MakeText(this, Resource.String.message_connected, ToastLength.Short).Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Disconnect();
|
||||
bLogin.Enabled = false;
|
||||
bLogin.Text = Resources.GetString(Resource.String.button_login);
|
||||
bConnect.Text = Resources.GetString(Resource.String.button_connect);
|
||||
bSendAvatar.Enabled = false;
|
||||
bSendProfile.Enabled = false;
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_disconnected), ToastLength.Short).Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateLoginStatus(bool LoggedIn)
|
||||
{
|
||||
loggedIn = LoggedIn;
|
||||
|
||||
if (LoggedIn)
|
||||
{
|
||||
bLogin.Text = Resources.GetString(Resource.String.button_logout);
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_logged_in), ToastLength.Short).Show();
|
||||
bSendAvatar.Enabled = true;
|
||||
bSendProfile.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_logged_out), ToastLength.Short).Show();
|
||||
client.Disconnect();
|
||||
bConnect.Text = Resources.GetString(Resource.String.button_connect);
|
||||
bSendAvatar.Enabled = false;
|
||||
bSendProfile.Enabled = false;
|
||||
Toast.MakeText(this, Resources.GetString(Resource.String.message_disconnected), ToastLength.Short).Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,5 @@
|
||||
<application android:label="AndroidRemote" android:icon="@drawable/icon"></application>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
+44
-84
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18034
|
||||
// Laufzeitversion:4.0.30319.18047
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
@@ -47,9 +47,6 @@ namespace AndroidRemote
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
// aapt resource value: 0x7f020001
|
||||
public const int monoandroidsplash = 2130837505;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
@@ -63,35 +60,35 @@ namespace AndroidRemote
|
||||
public partial class Id
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f060002
|
||||
public const int btConnect = 2131099650;
|
||||
// aapt resource value: 0x7f050004
|
||||
public const int btConnect = 2131034116;
|
||||
|
||||
// aapt resource value: 0x7f060005
|
||||
public const int btLogin = 2131099653;
|
||||
// aapt resource value: 0x7f050005
|
||||
public const int btDiscover = 2131034117;
|
||||
|
||||
// aapt resource value: 0x7f060006
|
||||
public const int btSendAvatar = 2131099654;
|
||||
// aapt resource value: 0x7f050006
|
||||
public const int btSendAvatar = 2131034118;
|
||||
|
||||
// aapt resource value: 0x7f060009
|
||||
public const int btSendProfile = 2131099657;
|
||||
// aapt resource value: 0x7f050009
|
||||
public const int btSendProfile = 2131034121;
|
||||
|
||||
// aapt resource value: 0x7f060001
|
||||
public const int tbIP = 2131099649;
|
||||
// aapt resource value: 0x7f050001
|
||||
public const int tbIP = 2131034113;
|
||||
|
||||
// aapt resource value: 0x7f060004
|
||||
public const int tbPassword = 2131099652;
|
||||
// aapt resource value: 0x7f050003
|
||||
public const int tbPassword = 2131034115;
|
||||
|
||||
// aapt resource value: 0x7f060008
|
||||
public const int tbPlayerName = 2131099656;
|
||||
// aapt resource value: 0x7f050008
|
||||
public const int tbPlayerName = 2131034120;
|
||||
|
||||
// aapt resource value: 0x7f060000
|
||||
public const int textView1 = 2131099648;
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int textView1 = 2131034112;
|
||||
|
||||
// aapt resource value: 0x7f060003
|
||||
public const int textView2 = 2131099651;
|
||||
// aapt resource value: 0x7f050002
|
||||
public const int textView2 = 2131034114;
|
||||
|
||||
// aapt resource value: 0x7f060007
|
||||
public const int textView3 = 2131099655;
|
||||
// aapt resource value: 0x7f050007
|
||||
public const int textView3 = 2131034119;
|
||||
|
||||
static Id()
|
||||
{
|
||||
@@ -109,9 +106,6 @@ namespace AndroidRemote
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
|
||||
// aapt resource value: 0x7f030001
|
||||
public const int monoandroidsplash = 2130903041;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
@@ -135,55 +129,37 @@ namespace AndroidRemote
|
||||
public const int button_disconnect = 2130968578;
|
||||
|
||||
// aapt resource value: 0x7f040003
|
||||
public const int button_login = 2130968579;
|
||||
public const int button_send_avatar = 2130968579;
|
||||
|
||||
// aapt resource value: 0x7f040004
|
||||
public const int button_logout = 2130968580;
|
||||
|
||||
// aapt resource value: 0x7f040005
|
||||
public const int button_send_avatar = 2130968581;
|
||||
|
||||
// aapt resource value: 0x7f040006
|
||||
public const int button_send_profile = 2130968582;
|
||||
|
||||
// aapt resource value: 0x7f040012
|
||||
public const int ip_address = 2130968594;
|
||||
|
||||
// aapt resource value: 0x7f040007
|
||||
public const int message_connected = 2130968583;
|
||||
|
||||
// aapt resource value: 0x7f040008
|
||||
public const int message_disconnected = 2130968584;
|
||||
|
||||
// aapt resource value: 0x7f040009
|
||||
public const int message_logged_in = 2130968585;
|
||||
|
||||
// aapt resource value: 0x7f04000a
|
||||
public const int message_logged_out = 2130968586;
|
||||
|
||||
// aapt resource value: 0x7f04000b
|
||||
public const int message_login_failed = 2130968587;
|
||||
|
||||
// aapt resource value: 0x7f04000e
|
||||
public const int message_nok = 2130968590;
|
||||
|
||||
// aapt resource value: 0x7f04000d
|
||||
public const int message_ok = 2130968589;
|
||||
public const int button_send_profile = 2130968580;
|
||||
|
||||
// aapt resource value: 0x7f04000c
|
||||
public const int message_wrong_password = 2130968588;
|
||||
public const int ip_address = 2130968588;
|
||||
|
||||
// aapt resource value: 0x7f040013
|
||||
public const int password = 2130968595;
|
||||
// aapt resource value: 0x7f040005
|
||||
public const int message_connected = 2130968581;
|
||||
|
||||
// aapt resource value: 0x7f04000f
|
||||
public const int text_ip_address = 2130968591;
|
||||
// aapt resource value: 0x7f040006
|
||||
public const int message_disconnected = 2130968582;
|
||||
|
||||
// aapt resource value: 0x7f040010
|
||||
public const int text_password = 2130968592;
|
||||
// aapt resource value: 0x7f040008
|
||||
public const int message_nok = 2130968584;
|
||||
|
||||
// aapt resource value: 0x7f040011
|
||||
public const int text_player_name = 2130968593;
|
||||
// aapt resource value: 0x7f040007
|
||||
public const int message_ok = 2130968583;
|
||||
|
||||
// aapt resource value: 0x7f04000d
|
||||
public const int password = 2130968589;
|
||||
|
||||
// aapt resource value: 0x7f040009
|
||||
public const int text_ip_address = 2130968585;
|
||||
|
||||
// aapt resource value: 0x7f04000a
|
||||
public const int text_password = 2130968586;
|
||||
|
||||
// aapt resource value: 0x7f04000b
|
||||
public const int text_player_name = 2130968587;
|
||||
|
||||
static String()
|
||||
{
|
||||
@@ -194,22 +170,6 @@ namespace AndroidRemote
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Style
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int Mono_Android_Theme_Splash = 2131034112;
|
||||
|
||||
static Style()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Style()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 60 KiB |
@@ -15,11 +15,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/tbIP"
|
||||
android:text="@string/ip_address" />
|
||||
<Button
|
||||
android:text="@string/button_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btConnect" />
|
||||
<TextView
|
||||
android:text="@string/text_password"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
@@ -32,11 +27,15 @@
|
||||
android:id="@+id/tbPassword"
|
||||
android:text="@string/password" />
|
||||
<Button
|
||||
android:text="@string/button_login"
|
||||
android:text="@string/button_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btLogin"
|
||||
android:enabled="false" />
|
||||
android:id="@+id/btConnect" />
|
||||
<Button
|
||||
android:text="Discover"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btDiscover" />
|
||||
<Button
|
||||
android:text="@string/button_send_avatar"
|
||||
android:layout_width="fill_parent"
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">AndroidRemote</string>
|
||||
<string name="app_name">Vocaluxe App</string>
|
||||
<string name="button_connect">Connect</string>
|
||||
<string name="button_disconnect">Disconnect</string>
|
||||
<string name="button_login">Login</string>
|
||||
<string name="button_logout">Logout</string>
|
||||
<string name="button_send_avatar">Send Avatar Picture</string>
|
||||
<string name="button_send_profile">Send Profile</string>
|
||||
<string name="message_connected">Connected</string>
|
||||
<string name="message_disconnected">Disconnected</string>
|
||||
<string name="message_logged_in">Logged in</string>
|
||||
<string name="message_logged_out">Logged out</string>
|
||||
<string name="message_login_failed">Login failed</string>
|
||||
<string name="message_wrong_password">Wrong Password</string>
|
||||
<string name="message_ok">Success</string>
|
||||
<string name="message_nok">Error</string>
|
||||
<string name="text_ip_address">IP Address of Vocaluxe Server:</string>
|
||||
<string name="text_password">Password:</string>
|
||||
<string name="text_player_name">Player Name:</string>
|
||||
<string name="ip_address">192.168.178.57</string>
|
||||
<string name="ip_address"></string>
|
||||
<string name="password">vocaluxe</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user