Add uicore files
This commit is contained in:
1 parent
3060386a23
commit
0ebdbab71e
7 files changed
+89
-78
No files matched your search
@@ -31,6 +31,7 @@
|
||||
<ItemGroup>
|
||||
<Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
|
||||
<Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />
|
||||
<Proto3 Include="uicore\Settings\UISettings.proto" />
|
||||
</ItemGroup>
|
||||
<Target Name="diagnostic" AfterTargets="PreBuildEvent">
|
||||
<Message Importance="High" Text="msbuild sucks" />
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace mbts.persist
|
||||
{
|
||||
public abstract class UISettingsBase : IPersist, IUserPersist, IDisposable
|
||||
{
|
||||
private IntPtr _client;
|
||||
protected abstract string user();
|
||||
string uns(string ns) { return $"{user()}#{ns}"; }
|
||||
PersistenceService _persist;
|
||||
|
||||
@@ -8,28 +8,32 @@ using mbts.config;
|
||||
using mbts.persist;
|
||||
using bts.api.core;
|
||||
using bts.api.user;
|
||||
using bts.api.persistence;
|
||||
|
||||
namespace mbts.ui.settings
|
||||
{
|
||||
[Export(typeof(IUserPersistFactory))]
|
||||
class UISettingsFactory : IUserPersistFactory
|
||||
{
|
||||
readonly ServiceContext _ctx;
|
||||
Task<string[]> _users;
|
||||
readonly PersistenceService _persist;
|
||||
|
||||
[ImportingConstructor]
|
||||
public UISettingsFactory([Import("username")] string current_user, ServiceContext ctx, UserService login) {
|
||||
// Get the list of all UI visible users
|
||||
_ctx = ctx;
|
||||
TaskCompletionSource<string[]> users_task = new TaskCompletionSource<string[]>();
|
||||
login.get_logins(new LoginRequest()).ContinueWith(resp => _users = users_task.TrySetResult(resp.user.ToArray()));
|
||||
_users = users_task.Task;
|
||||
public UISettingsFactory([Import("username")] string current_user, UserService login, [Import("settings")] PersistenceService persist) {
|
||||
_persist = persist;
|
||||
_users = get_users(login);
|
||||
}
|
||||
|
||||
async Task<string[]> get_users(UserService login) {
|
||||
var users = await login.get_logins_async(null);
|
||||
if (users.success) return users.result.Login.ToArray();
|
||||
else return new string[0];
|
||||
}
|
||||
|
||||
public IEnumerable<string> users() { return _users.Result; }
|
||||
|
||||
public IUserPersist get_persist_for(string user) {
|
||||
return new UserUISettings(user, _ctx);
|
||||
return new UserUISettings(user, _persist);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using ProtoBuf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace mbts.ui.shell {
|
||||
public enum DockState {
|
||||
FLOATING = 1,
|
||||
TOP = 2,
|
||||
BOTTOM = 3,
|
||||
LEFT = 4,
|
||||
RIGHT = 5,
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public class WindowPosition {
|
||||
[ProtoMember(3)]
|
||||
public int width;
|
||||
[ProtoMember(4)]
|
||||
public int height;
|
||||
[ProtoMember(5)]
|
||||
public int left;
|
||||
[ProtoMember(6)]
|
||||
public int top;
|
||||
[ProtoMember(7)]
|
||||
public bool is_maximized;
|
||||
[ProtoMember(8)]
|
||||
public string host_id;
|
||||
[ProtoMember(9)]
|
||||
public int tab_index;
|
||||
|
||||
[ProtoMember(100)]
|
||||
public bool horizontal = true;
|
||||
[ProtoMember(101)]
|
||||
public bool show_text = true;
|
||||
[ProtoMember(102)]
|
||||
public bool always_on_top = false;
|
||||
[ProtoMember(103)]
|
||||
public DockState dock = DockState.FLOATING;
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public class WindowState {
|
||||
[ProtoMember(1)]
|
||||
public string owner;
|
||||
[ProtoMember(2)]
|
||||
public byte[] app_data;
|
||||
|
||||
//optional bool is_open = 3 [default = true];
|
||||
//optional bool is_favorite = 4;
|
||||
//optional string title = 5;
|
||||
|
||||
//optional string id = 6;
|
||||
// optional bool is_loaded = 7 [default = false];
|
||||
[ProtoMember(8)]
|
||||
public WindowPosition position;
|
||||
|
||||
[ProtoMember(9)]
|
||||
public string title;
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public class ModuleState {
|
||||
[ProtoMember(1)]
|
||||
public string name;
|
||||
[ProtoMember(2)]
|
||||
public byte[] app_data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
// todo: MAKE THIS INTO CODE
|
||||
|
||||
syntax='proto2';
|
||||
|
||||
package mbts.ui.shell;
|
||||
|
||||
enum DockState {
|
||||
FLOATING = 1;
|
||||
TOP = 2;
|
||||
BOTTOM = 3;
|
||||
LEFT = 4;
|
||||
RIGHT = 5;
|
||||
}
|
||||
|
||||
message WindowPosition
|
||||
{
|
||||
optional int32 width = 3;
|
||||
optional int32 height = 4;
|
||||
optional int32 left = 5;
|
||||
optional int32 top = 6;
|
||||
optional bool is_maximized = 7;
|
||||
optional string host_id = 8;
|
||||
optional int32 tab_index = 9;
|
||||
|
||||
// Main window related
|
||||
optional bool horizontal = 100 [default = true];
|
||||
optional bool show_text = 101 [default = true];
|
||||
optional bool always_on_top = 102 [default = false];
|
||||
optional DockState dock = 103 [default = FLOATING];
|
||||
}
|
||||
|
||||
message WindowState
|
||||
{
|
||||
optional string owner = 1;
|
||||
optional bytes app_data = 2;
|
||||
|
||||
//optional bool is_open = 3 [default = true];
|
||||
//optional bool is_favorite = 4;
|
||||
//optional string title = 5;
|
||||
|
||||
//optional string id = 6;
|
||||
// optional bool is_loaded = 7 [default = false];
|
||||
optional WindowPosition position = 8;
|
||||
|
||||
optional string title = 9;
|
||||
}
|
||||
|
||||
message ModuleState
|
||||
{
|
||||
optional string name = 1;
|
||||
optional bytes app_data = 2;
|
||||
}
|
||||
|
||||
message EXEShellSettings
|
||||
{
|
||||
repeated string running = 1;
|
||||
}
|
||||
|
||||
message AdminShellSettings
|
||||
{
|
||||
optional EXEShellSettings shell_settings = 1;
|
||||
repeated string rec_report_providers_and_args = 2;
|
||||
repeated string trade_migration_providers_and_args = 3;
|
||||
optional bool trade_migration_add_missing_data_is_checked = 4 [default = true];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using bts.security_model;
|
||||
|
||||
namespace mbts.ui.utility
|
||||
{
|
||||
public class ExpirationFormatter
|
||||
class ExpirationFormatter
|
||||
{
|
||||
private static class DateFormatter
|
||||
{
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace bts.log {
|
||||
internal enum Subsystem {
|
||||
gen,
|
||||
Assert,
|
||||
ui
|
||||
ui,
|
||||
Persist
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user