SPARK-1410 Fix shell browser window

This commit is contained in:
Eric Harding committed 2018-08-08 16:25:06 -04:00
1 parent 17f8fa74ea
commit eb8e5ea353
17 files changed
+182 -469

No files matched your search

+4 -4
View File
@@ -18,13 +18,13 @@ namespace bts.ui {
[Export, Export(typeof(IShellDaemon))]
class AboutDaemon : IShellDaemon, IDisposable {
readonly string _user;
readonly IBrowserWindowManager _browser;
readonly IBus _bus;
IDisposable _dispose;
[ImportingConstructor]
public AboutDaemon(IBus bus, [Import("username")]string username, IBrowserWindowManager browser) {
public AboutDaemon(IBus bus, [Import("username")]string username) {
_user = username;
_browser = browser;
_bus = bus;
_dispose = bus.subscribe(SparkTags.About).OnDispatcher().Subscribe(_ => show_about());
}
@@ -50,7 +50,7 @@ namespace bts.ui {
}
else if (!string.IsNullOrEmpty(param)) {
Uri address = new Uri("bts://" + param);
_browser.Pages.Add(address);
_bus.post(SparkTags.ShowUri, address);
}
}
}));
+3 -1
View File
@@ -44,7 +44,9 @@ namespace mbts.ui
public static ImageSource DataCopy { get { return load_image("DataCopy.ico"); } }
public static ImageSource Refresh { get { return load_image("Refresh.png"); } }
public static ImageSource FavoriteWindow { get { return load_image("FavoriteWindow.png"); } }
//public static ImageSource Ticket { get { return load_image("Ticket.png"); } } // replaced with AddOrders
public static ImageSource Browser => (DrawingImage)_resources["Browser"];
public static ImageSource Date { get { return load_image("Date.png"); } }
public static ImageSource Cube3d { get { return (DrawingImage)_resources["Cube"]; } }
+13
View File
@@ -753,6 +753,19 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="Browser" x:Shared="False">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
Brush="Black"
Geometry="M25.400009,21.400005L29.800003,21.400005C28.100006,24.100017 25.400009,26.200025 22.300003,27.200025 23,26.500013 23.600006,25.600019 24.199997,24.600017 24.699997,23.600017 25.100006,22.500011 25.400009,21.400005z M19,21.400005L24,21.400005C23.699997,22.299998 23.300003,23.200023 22.900009,23.900005 21.800003,26.000013 20.400009,27.3 18.900009,27.700025z M12.300003,21.400005L17.699997,21.400005 17.600006,27.8C16,27.600019 14.5,26.200025 13.300003,23.900005 13,23.100017 12.600006,22.299998 12.300003,21.400005z M26.5,14.700019L32,14.700019C31.900009,16.600013,31.400009,18.400003,30.600006,20.100015L25.900009,20.100015C26.199997,18.400003,26.5,16.600013,26.5,14.700019z M19.100006,14.700019L25.199997,14.700019C25.100006,16.600013,24.900009,18.400003,24.400009,20.100015L19,20.100015z M16.199997,14.700019L17.699997,14.700019 17.699997,20.100015 12,20.100015C11.900009,19.799997,11.900009,19.500009,11.800003,19.200021L15.5,15.500007z M25.900009,7.7999913L30.600006,7.7999913C31.400009,9.500004,31.900009,11.399999,32,13.4L26.5,13.4C26.5,11.399999,26.300003,9.500004,25.900009,7.7999913z M19.100006,7.7999913L24.5,7.7999913C24.900009,9.500004,25.199997,11.399999,25.199997,13.4L19.100006,13.4z M12.100006,7.7999913L17.800003,7.7999913 17.800003,13.4 11.300003,13.4C11.300003,11.299993,11.600006,9.3999979,12.100006,7.7999913z M22.5,0.6000061C25.600006,1.6000066,28.199997,3.6000077,29.900009,6.3999969L25.600006,6.3999969C25.300003,5.2999904 24.900009,4.2000138 24.400009,3.2999892 23.800003,2.2999887 23.199997,1.3999944 22.5,0.6000061z M14.199997,0.6000061C13.5,1.2999882 12.900009,2.2000131 12.300003,3.2000136 10.900009,5.8999965 10,9.8999988 9.9000092,14.000007L9.9000092,14.700019 14.5,14.700019 7.1999969,22.000011 0,14.600013 4.5,14.600013 4.5,13.900001C4.5,7.7000157,8.6000061,2.2999887,14.199997,0.6000061z M19.199997,0.1000061C20.600006,0.50000006 22,1.7999884 23.100006,3.8999953 23.5,4.7000143 23.800003,5.5000026 24.100006,6.3999969L19.100006,6.3999969z M17.900009,0L17.800003,6.3999969 12.400009,6.3999969C12.699997,5.5000026 13.100006,4.6000082 13.5,3.7999892 14.699997,1.5000005 16.300003,0.20001213 17.900009,0z"
/>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<!-- Pin
<Path Data="F1M3,11L3,7 0,7 0,6 1,6 1,1 1,0 6,0 6,1 6,6 7,6 7,7 4,7 4,11 3,11z M2,1L2,6 4,6 4,1 2,1z" />
Unpin
@@ -0,0 +1,106 @@
using bts.api;
using mbts.config;
using mbts.spark;
using mbts.ui;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using System.Windows.Controls;
using mbts;
namespace bts.shell {
public class BrowserWindow : IShellWindow {
const string _window_type = "Browser";
readonly WebBrowser _browser;
readonly ISaveWindow<BrowserWindowState> _isw;
public BrowserWindow(Uri uri, ISaveWindow<BrowserWindowState> isw) {
_isw = isw;
this.Owner = isw.module;
this.Title = "Loading...";
initial_uri = uri;
this.uri = coerce_uri(uri);
_browser = new WebBrowser() { Width = 1024 };
_browser.Navigated += _browser_Navigated;
_browser.Navigate(this.uri);
_browser.LoadCompleted += _browser_Navigated;
}
public Uri uri { get; private set; }
public Uri initial_uri { get; private set; }
void _browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) {
uri = e.Uri;
dynamic doc = _browser.Document;
if (doc != null) {
try {
Title = doc.Title;
TitleChanged();
//doc.document.is_bts_shell = true;
}
catch { }
}
}
private Uri coerce_uri(Uri uri) {
if (uri.Scheme == "bts") {
string uristr = uri.ToString();
string http_base =
"http://{0}:{1}/".fmt(
Configuration.get<bts.config.System>().config_host,
Configuration.get<bts.config.System>().config_port);
string temp = uristr;
if (uristr.StartsWith("bts://m/")) {
temp = uristr.Replace("bts://m/", http_base + "doc/manual/");
}
else {
temp = uristr.Replace("bts://", http_base);
}
return new Uri(temp, UriKind.Absolute);
}
return uri;
}
#region IShellWindow
public string Title { get; set; }
public event Action TitleChanged = () => { };
public System.Windows.Media.ImageSource Icon { get { return Icons.Browser; } }
public event Action IconChanged = () => { };
public string window_type => _window_type;
public IShellModule Owner {get; set; }
public ShellWindowUI GetContent() { return new ShellWindowUI(_browser); }
public void GetState(System.IO.Stream save_here) {
_isw.save(new bts.shell.BrowserWindowState() { uri = uri.ToString() }, save_here);
}
public void Dispose() {
if (_browser != null) {
_browser.Dispose();
}
}
#endregion
#region Fixup Browser control to use IE11 if available
static BrowserWindow() {
string ke_name = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
var emulation_key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(ke_name, true);
if (emulation_key == null) {
emulation_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(ke_name);
}
var process_name = Configuration.get<bts.config.System>().process_name;
emulation_key.SetValue(process_name, 11001); // IE11
}
#endregion
}
}
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using bts.api;
using mbts.spark;
using mbts.ui;
namespace bts.shell {
class BrowserWindowFactory : ShellWindowFactory<BrowserWindowState> {
readonly IBus _bus;
public BrowserWindowFactory(IShellModule owner, IBus bus, int version = 1) : base(owner, "Browser", version) {
_bus = bus;
_dispose =
bus.subscribe(SparkTags.ShowUri).Subscribe(show);
}
IShellWindow create(Uri uri) => new BrowserWindow(uri, this);
void show(Uri uri) {
_bus.post(SparkTags.ShowWindow, create(uri));
}
public override Task<IShellWindow> load(BrowserWindowState state) {
return Task.FromResult(create(new Uri(state.uri)));
}
}
[ProtoBuf.ProtoContract]
public class BrowserWindowState {
[ProtoBuf.ProtoMember(1)]
public string uri { get; set; }
}
}
@@ -17,17 +17,15 @@ using static mbts.ui.shell.ProtoBufSerializationHelper;
namespace bts.shell {
[Export(typeof(IShellModule))]
class HelpShellModule : IShellModule {
IDisposable _dispose;
[ImportingConstructor]
public HelpShellModule(IBus bus, IBrowserWindowManager browser) {
public HelpShellModule(IBus bus) {
_awf = new ActivityWindowFactory(this, bus);
_dispose = Disposable.Create(
bus.subscribe(SparkTags.ShowUri).OnDispatcher().Subscribe(u => browser.Pages.Add(u))
);
_bwf = new BrowserWindowFactory(this, bus);
}
ActivityWindowFactory _awf;
BrowserWindowFactory _bwf;
public ImageSource icon => Icons.Support;
@@ -41,14 +39,17 @@ namespace bts.shell {
//SparkCommands.ShowDiagnostics,
SparkCommands.ShowReportIssue.complete("Created from launcher"),
SparkCommands.ShowAboutSpark,
SparkCommands.ShowActivityLog
// SparkCommands.ShowReleaaseNotes,
SparkCommands.ShowActivityLog,
};
public Task<IShellWindow> create(Stream load_stream) {
return dispatch_to_factory(load_stream, _awf);
return dispatch_to_factory(load_stream, _awf, _bwf);
}
public void Dispose() {
Disposable.dispose(ref _awf);
Disposable.dispose(ref _bwf);
}
}
}
-20
View File
@@ -61,27 +61,7 @@ namespace mbts.ui.shell
}
launcher.show();
model.notify_delayed_load();
DisplayStartUrl();
}
private static async void DisplayStartUrl() {
//TODO: do this with IDelayLoad
// If a url was provided at startup launch that page now.
if (Environment.CommandLine.Contains("-url")) {
var cmd = Environment.GetCommandLineArgs();
var index = Array.IndexOf(cmd, "-url");
if (cmd.Length > index + 1) {
string url = cmd[index + 1];
if (url.StartsWith("bts://")) {
Uri uri = new Uri(url, UriKind.RelativeOrAbsolute);
Logger.log("Loading url on startup: " + uri);
// Ensure this page loads *after* the Workspace is loaded
await Task.Delay(500);
await mbts.ui.controls.BrowserSingleton.open(uri);
}
}
}
}
}
}
@@ -76,6 +76,9 @@ namespace bts.spark
public static SparkCommand ShowManual =>
SparkCommand.create("Manual", Icons.Book, SparkTags.ShowUri, new Uri("bts://m/"));
public static SparkCommand ShowReleaaseNotes =>
SparkCommand.create("Release Notes", Icons.Browser, SparkTags.ShowUri, new Uri("bts://files/release_notes.txt"));
public static SparkCommand ShowAuditLogs =>
SparkCommand.create("Audit Logs", Icons.Book, SparkTags.NotImplemented);
@@ -14,7 +14,7 @@ namespace bts.shell {
Task<IShellWindow> load_window(Stream load_stream, int version);
}
interface ISaveWindow<T> {
public interface ISaveWindow<T> {
IShellModule module { get; }
void save(T data, Stream output);
}
@@ -16,9 +16,4 @@ namespace mbts.ui {
void AlertWindow(IShellWindow window);
bool IsVisible(IShellWindow window);
}
public interface IBrowserWindowManager {
ObservableCollection<Uri> Pages { get; }
IShellWindow create_hidden(Uri uri);
}
}
@@ -1,188 +0,0 @@
using bts.api;
using mbts.config;
using mbts.spark;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace mbts.ui.controls {
public class BrowserWindow : IShellWindow {
const string _window_type = "Browser";
private WebBrowser _browser;
public BrowserWindow(Uri uri, IShellModule owner) {
this.Owner = owner;
this.Title = "Loading...";
initial_uri = uri;
this.uri = coerce_uri(uri);
_browser = new WebBrowser() { Width = 1024 };
_browser.Navigated += _browser_Navigated;
_browser.Navigate(this.uri);
_browser.LoadCompleted += _browser_Navigated;
}
public Uri uri { get; private set; }
public Uri initial_uri { get; private set; }
void _browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) {
uri = e.Uri;
dynamic doc = _browser.Document;
if (doc != null) {
try {
Title = doc.Title;
TitleChanged();
//doc.document.is_bts_shell = true;
}
catch { }
}
}
private Uri coerce_uri(Uri uri) {
if (uri.Scheme == "bts") {
string uristr = uri.ToString();
string http_base =
"http://{0}:{1}/".fmt(
Configuration.get<bts.config.System>().config_host,
Configuration.get<bts.config.System>().config_port);
string temp = uristr;
if (uristr.StartsWith("bts://m/")) {
temp = uristr.Replace("bts://m/", http_base + "doc/manual/");
}
else {
temp = uristr.Replace("bts://", http_base);
}
return new Uri(temp, UriKind.Absolute);
}
return uri;
}
#region IShellWindow
public string Title { get; set; }
public event Action TitleChanged = () => { };
public System.Windows.Media.ImageSource Icon { get { return Icons.FavoriteWindow; } }
public event Action IconChanged = () => { };
public string window_type => _window_type;
public IShellModule Owner {get; set; }
public ShellWindowUI GetContent() { return new ShellWindowUI(_browser); }
public void GetState(System.IO.Stream save_here) {
ProtoBuf.Serializer.SerializeWithLengthPrefix(save_here, new ShellSerializationHeader() { version = 1, name = "Browser" }, PrefixStyle.Fixed32);
//ProtoBuf.Serializer.SerializeWithLengthPrefix(save_here, new mbts.ui.shell.BrowserWindowState() { uri = uri.ToString() }, PrefixStyle.Fixed32);
}
public void Dispose() {
if (_browser != null) {
_browser.Dispose();
}
}
#endregion
#region Fixup Browser control to use IE11 if available
static BrowserWindow() {
string ke_name = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
var emulation_key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(ke_name, true);
if (emulation_key == null) {
emulation_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(ke_name);
}
var process_name = config.Configuration.get<bts.config.System>().process_name;
emulation_key.SetValue(process_name, 11001); // IE11
}
#endregion
}
[Export(typeof(IInitializable))]
public class BrowserSingleton : IInitializable
{
private static BrowserSingleton _instance;
private IBrowserWindowManager _bwm;
[ImportingConstructor]
BrowserSingleton(IBus bus, IBrowserWindowManager ibwm) {
_bwm = ibwm;
bus.subscribe(SparkTags.ShowUri).Subscribe(ibwm.Pages.Add);
}
public static async Task open(Uri uri) {
while (_instance == null) {
await Task.Delay(100);
}
_instance._bwm.Pages.Add(uri);
}
#region IInitializable
int IInitializable.priority {
get { return 4096; }
}
void IInitializable.initialize() {
_instance = this;
register();
}
#endregion
private void register() {
var key_exists = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("bts");
if (key_exists == null) {
try {
var key = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey("bts", Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree);
key.SetValue("", "URL:bts");
key.SetValue("URL Protocol", "");
var open = key.CreateSubKey(@"shell\open\command");
var uri = new Uri(System.Reflection.Assembly.GetEntryAssembly().CodeBase);
open.SetValue("", string.Format("\"{0}\" -url %1", uri.LocalPath));
}
catch (Exception e) {
Logger.log(bts.log.Level.Warn, bts.log.Subsystem.Ui, "Failed to register bts:// url extension. " + e.Message);
}
}
}
}
[Export(typeof(IInitializable))]
class OutOfProcessUrlListener : IInitializable, IDisposable
{
IDisposable _subscription;
//DesktopBus _bus;
IBrowserWindowManager _bwm;
[ImportingConstructor]
public OutOfProcessUrlListener(IBrowserWindowManager ibwm) {
_bwm = ibwm;
}
private void callback(string topic, string msg) {
try {
Uri uri = new Uri(msg);
_bwm.Pages.Add(uri);
}
catch (UriFormatException) { }
}
public int priority {
get { return 4098; }
}
public void initialize() {
//_subscription = _bus.subscribe<string>("open_url", callback);
//_bus = null;
}
public void Dispose() {
if (_subscription != null) {
_subscription.Dispose();
_subscription = null;
}
}
}
}
+3 -21
View File
@@ -16,30 +16,12 @@ namespace mbts.ui.controls
const string base_uri = "bts://m/";
public HelpButton() {
this.Click += HelpButton_Click;
}
private Uri _compose_help_uri(string input)
{
string output = base_uri + input;
if (!input.Contains(".html")) {
output += ".html";
}
return new Uri(output);
}
async void HelpButton_Click(object sender, RoutedEventArgs e) {
if (!String.IsNullOrEmpty(ManPage)) {
await Task.Yield();
await BrowserSingleton.open(_compose_help_uri(ManPage));
}
// To use this bind the Command to your viewmodel
}
public string ManPage {
get { return (string)GetValue(ManPageProperty); }
set { SetValue(ManPageProperty, value); }
get { return (string)GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value); }
}
public static readonly DependencyProperty ManPageProperty =
DependencyProperty.Register("ManPage", typeof(string), typeof(HelpButton), new PropertyMetadata(string.Empty));
}
}
-112
View File
@@ -1,112 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using mbts.ui.controls;
namespace mbts.ui.shell
{
[Export(typeof(IBrowserWindowManager))]
class ShellBrowser : IBrowserWindowManager
{
IShellModule _owner;
IWindowManager _wm;
ObservableCollection<IShellModule> _modules;
public System.Collections.ObjectModel.ObservableCollection<Uri> Pages { get; private set; }
[ImportingConstructor]
public ShellBrowser(IWindowManager wm, ObservableCollection<IShellModule> modules) {
_modules = modules;
_wm = wm;
Pages = new ObservableCollection<Uri>();
Pages.CollectionChanged += Pages_CollectionChanged;
// We need to MetaShellModule when it is created
modules.CollectionChanged += modules_CollectionChanged;
}
void Pages_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) {
switch (e.Action) {
case NotifyCollectionChangedAction.Remove:
foreach (var i in e.OldItems) {
destroy_window((Uri)i);
}
break;
case NotifyCollectionChangedAction.Add:
foreach(var i in e.NewItems) {
create_window((Uri)i);
}
break;
default: break;
}
}
void create_window(Uri uri) {
if (Pages.Contains(uri)) {
var w = _wm.list_windows().OfType<BrowserWindow>().Where(b => b.initial_uri == uri).SingleOrDefault();
if (w != null) {
_wm.MakeVisible(w);
return;
}
}
// TODO: If the browser is navigated the Uri list becomes stale and should be updated
// This would also solve the "initial uri" problem
_wm.add(new BrowserWindow(uri, _owner));
}
async void destroy_window(Uri uri) {
var w = _wm.list_windows().OfType<BrowserWindow>().Where(b => b.initial_uri == uri).FirstOrDefault();
if (w != null) {
await Task.Yield();
_wm.remove(w);
}
}
async void destroy_window(BrowserWindow window) {
if (Pages.Contains(window.initial_uri)) {
await Task.Yield();
Pages.Remove(window.initial_uri);
}
}
void create_window(BrowserWindow window) {
if (!Pages.Contains(window.initial_uri)) {
Pages.Add(window.initial_uri);
}
}
#region Find MetaShellModule
void modules_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) {
//if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) {
// foreach (var item in e.NewItems) {
// if (item is MetaShellMenuModule) {
// set_owner((IShellModule)item);
// _modules.CollectionChanged -= modules_CollectionChanged;
// _modules = null;
// return;
// }
// }
//}
}
void set_owner(IShellModule owner) {
_owner = owner;
foreach (var window in _wm.list_windows()) {
var bw = window as mbts.ui.controls.BrowserWindow;
if (bw != null) {
bw.Owner = owner;
}
}
}
#endregion
public IShellWindow create_hidden(Uri uri) {
return new BrowserWindow(uri, _owner);
}
}
}
@@ -1,34 +0,0 @@
<UserControl x:Class="mbts.ui.shell.ShellLaunchMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:mbts.ui.controls"
xmlns:cv="clr-namespace:mbts.ui.converters"
Background="Transparent"
MinWidth="250"
MinHeight="10"
MaxHeight="{StaticResource MaxMenuHeight}">
<UserControl.Resources>
<ResourceDictionary>
<cv:NullToVisibilityConverter x:Key="NullToVisibilityConverter" VisibilityForNull="Hidden" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<ListBox ItemsSource="{Binding}" HorizontalContentAlignment="Stretch" Background="Transparent" BorderThickness="0">
<ListBox.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Button Content="{Binding name}" Command="{Binding command}" Style="{DynamicResource StartMenuButton}" HorizontalAlignment="Stretch" Foreground="{DynamicResource StartMenuForeground}" Padding="4"/>
<Rectangle Height="1" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="5,1,5,0" Fill="{DynamicResource StartMenuMouseOverBackground}" Visibility="{Binding separate_after, Converter={StaticResource BoolToVisibility}}" />
<c:HelpButton ManPage="{Binding man_page}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,8,0" Visibility="{Binding man_page, Converter={StaticResource NullToVisibilityConverter}}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>
@@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Input;
namespace mbts.ui.shell {
public class ShellLaunchMenuItem
{
public string name { get; set; }
public ICommand command { get; set; }
public bool separate_after { get; set; }
public string man_page { get; set; }
}
public partial class ShellLaunchMenu : UserControl, mbts.ui.IShellWindow
{
public ShellLaunchMenu() {
InitializeComponent();
}
public ShellLaunchMenu(IEnumerable<ShellLaunchMenuItem> items) {
InitializeComponent();
this.DataContext = items;
}
#region IShellWindow Members
private string _title = "";
public string Title
{
get { return _title; }
set
{
_title = value;
if (TitleChanged != null)
TitleChanged();
}
}
public System.Windows.Media.ImageSource Icon
{
get { return null; }
}
public event Action IconChanged = () => { };
public string window_type { get; set; }
public mbts.ui.IShellModule Owner
{
get { return null; }
set { }
}
public mbts.ui.ShellWindowUI GetContent() {
return new mbts.ui.ShellWindowUI(this);
}
public void GetState(System.IO.Stream save_here) { }
public event Action TitleChanged;
#endregion
#region IDisposable Members
public void Dispose() { }
#endregion
}
}
@@ -28,15 +28,15 @@ namespace mbts.ui.shell
string _user;
readonly IBus _bus;
bool _shown = false;
IBrowserWindowManager _browser;
ErrorReporter _error_service;
[ImportingConstructor]
public LauncherVM(ObservableCollection<IShellModule> modules, [Import("username")]string username,
IBrowserWindowManager browser, ErrorReporter errors, IBus bus) {
public LauncherVM(
ObservableCollection<IShellModule> modules,
[Import("username")]string username,
ErrorReporter errors, IBus bus) {
_user = username;
_modules = new ObservableAutoWrapper<ShellModuleVM, IShellModule>(modules, m => new ShellModuleVM(m, bus));
_browser = browser;
_error_service = errors;
_bus = bus;
}
@@ -72,7 +72,6 @@
</ScrollViewer>
</Grid>
<!--controls:HelpButton ManPage="Workspaces" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,8,0" /-->
<!--controls:DialogSkirtOKCancel Grid.Row="1" Grid.ColumnSpan="2"/-->
</Grid>
</Window>