本文整理汇总了C#中MainWindow.NewTab方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindow.NewTab方法的具体用法?C# MainWindow.NewTab怎么用?C# MainWindow.NewTab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow.NewTab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
var args = Args.Parse<DesktopGapCommandLineArguments> (e.Args);
//try
//{
var configurator = new DesktopGapConfigurator();
configurator.LoadFrom (args.ManifestUri);
configurator.SetInternetExplorerFeatures (TridentWebBrowserMode.ForcedIE10, true, true, true, true);
var startupUri = args.StartupUri;
if (configurator.EnableResourceFilter)
{
var filter = new ProtocolWrapperManager();
filter.RegisterProtocol (new FilteredHttpProtocolFactory (configurator.ResourceFilter));
filter.RegisterProtocol (new FilteredHttpsProtocolFactory (configurator.ResourceFilter));
}
var htmlDocumentHandleRegistry = configurator.CreateDocumentRegistry (".");
var subscriptionHandler = (ISubscriptionProvider) htmlDocumentHandleRegistry;
_browserFactory = new TridentWebBrowserFactory (
htmlDocumentHandleRegistry,
subscriptionHandler,
configurator.NonApplicationUrlFilter,
configurator.StartUpFilter,
configurator.AddInAllowedFilter);
var converter = new BrushConverter();
var applicationTabBrush = (Brush) converter.ConvertFrom (configurator.ApplicationTabColorCode);
var nonApplicationTabBrush = (Brush) converter.ConvertFrom (configurator.NonApplicationTabColorCode);
var homeTabBrush = (Brush) converter.ConvertFrom (configurator.HomeTabColorCode);
var states = new Dictionary<Tuple<TargetAddressType, BrowserTab.TabType>, BrowserTabState>
{
{
Tuple.Create (TargetAddressType.Application, BrowserTab.TabType.CommonTab),
new BrowserTabState
{
HeaderColor = applicationTabBrush,
IsClosable = true,
ShowAddressBar = configurator.Application.AlwaysShowUrl
}
},
{
Tuple.Create (TargetAddressType.NonApplication, BrowserTab.TabType.CommonTab),
new BrowserTabState
{
HeaderColor = nonApplicationTabBrush,
IsClosable = true,
ShowAddressBar = true
}
},
{
Tuple.Create (TargetAddressType.Application, BrowserTab.TabType.HomeTab),
new BrowserTabState
{
HeaderColor = homeTabBrush,
IsClosable = false,
ShowAddressBar = configurator.Application.AlwaysShowUrl
}
},
{
Tuple.Create (TargetAddressType.NonApplication, BrowserTab.TabType.HomeTab),
new BrowserTabState
{
HeaderColor = nonApplicationTabBrush,
IsClosable = false,
ShowAddressBar = true
}
},
};
var viewDispatcher = new TridentViewDispatcher (_browserFactory, subscriptionHandler, states);
htmlDocumentHandleRegistry.DocumentRegistered += viewDispatcher.OnDocumentRegistered;
htmlDocumentHandleRegistry.BeforeDocumentUnregister += viewDispatcher.OnBeforeDocumentUnregister;
var homeUri = configurator.Application.BaseUri;
if (configurator.Application.HomeUri != null)
homeUri = configurator.Application.HomeUri;
var mainWindow = new MainWindow (
configurator.Application.Name,
configurator.Application.IconUri != null
? new BitmapImage (configurator.Application.IconUri)
: (BitmapImage) Current.Resources[c_defaultAppIcon],
homeUri,
viewDispatcher);
if (configurator.Application.AlwaysOpenHomeUrl)
mainWindow.NewStickyTab (homeUri, BrowserWindowStartMode.Active);
if (startupUri != null && (configurator.StartUpFilter.IsAllowed (startupUri) || configurator.NonApplicationUrlFilter.IsAllowed (startupUri)))
mainWindow.NewTab (startupUri, BrowserWindowStartMode.Active);
//.........这里部分代码省略.........