本文整理汇总了C#中ActivatedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ActivatedEventArgs类的具体用法?C# ActivatedEventArgs怎么用?C# ActivatedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivatedEventArgs类属于命名空间,在下文中一共展示了ActivatedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnComponentActivated
static void OnComponentActivated(object sender, ActivatedEventArgs<object> args)
{
// nothing we can do if a null event argument is passed (should never happen)
if (args == null)
{
return;
}
// nothing we can do if instance is not a handler
var handler = args.Instance as IHandle;
if (handler == null)
{
return;
}
// subscribe to handler, and prepare unsubscription when it's time for disposal
var context = args.Context;
var lifetimeScope = context.Resolve<ILifetimeScope>();
var eventAggregator = lifetimeScope.Resolve<IEventAggregator>();
eventAggregator.Subscribe(handler);
var disposableAction = new DisposableAction(() =>
{
eventAggregator.Unsubscribe(handler);
});
lifetimeScope.Disposer.AddInstanceForDisposal(disposableAction);
}
开发者ID:brendankowitz,项目名称:Caliburn.Micro.Autofac,代码行数:30,代码来源:EventAggregationAutoSubscriptionModule.cs
示例2: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!App.ViewModel.IsDataLoaded)
{
App.ViewModel.LoadData();
}
}
示例3: Application_Activated
// アプリケーションがアクティブになった (前面に表示された) ときに実行されるコード
// このコードは、アプリケーションの初回起動時には実行されません
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
SearchHubApplication.Current.Load();
}
}
示例4: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
//Trace the event for debug purposes
Utils.Trace("Application Activated");
//Create new data object variable
TravelReportInfo travelReportInfo = null;
//Try to locate previous data in transient state of the application
if (PhoneApplicationService.Current.State.ContainsKey("UnsavedTravelReportInfo"))
{
//If found, initialize the data variable and remove in from application's state
travelReportInfo = PhoneApplicationService.Current.State["UnsavedTravelReportInfo"] as TravelReportInfo;
PhoneApplicationService.Current.State.Remove("UnsavedTravelReportInfo");
}
//If found set it as a DataContext for all the pages of the application
//An application is not guaranteed to be activated after it has been tombstoned,
//thus if not found create new data object
if (null != travelReportInfo)
RootFrame.DataContext = travelReportInfo;
else
RootFrame.DataContext = new TravelReportInfo();
}
}
示例5: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
PhoneApplicationService.Current.State["newpage"] = "true"; // adding newpage value for checking it later
if (PhoneApplicationService.Current.State.ContainsKey("hasspass")) // Checking if Isolated storage has key notelistiso
{
Settings.HashedPassword = (PhoneApplicationService.Current.State["hasspass"] as string); // Retriving Notes from Isolated storage
}
if (PhoneApplicationService.Current.State.ContainsKey("passhint")) // Checking if Isolated storage has key notelistiso
{
Settings.PasswordHint = (PhoneApplicationService.Current.State["passhint"] as string); // Retriving Notes from Isolated storage
}
if (PhoneApplicationService.Current.State.ContainsKey("pass")) // Checking if Isolated storage has key notelistiso
{
Settings.Password = (PhoneApplicationService.Current.State["pass"] as string); // Retriving Notes from Isolated storage
}
if (PhoneApplicationService.Current.State.ContainsKey("saltval")) // Checking if Isolated storage has key notelistiso
{
Settings.Salt = (PhoneApplicationService.Current.State["saltval"] as byte[]); // Retriving Notes from Isolated storage
}
if (PhoneApplicationService.Current.State.ContainsKey("notestate")) // Checking if State contains key notestate
{
Settings.NotesList = (PhoneApplicationService.Current.State["notestate"] as ObservableCollection<Note>); // Retriving Notes from State
}
}
}
示例6: registration_Activated
void registration_Activated(object sender, ActivatedEventArgs<object> e)
{
if (e.Instance.GetType().GetInterfaces().Any(x=>x.Name.Contains("IHandle")))
{
ContainerFactory.Container.Resolve<IEventAggregator>().Subscribe(e.Instance);
}
}
示例7: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (PhoneApplicationService.Current.State.ContainsKey("AccountDB"))
{
this.WorkingDB = (AccountDB)PhoneApplicationService.Current.State["AccountDB"];
}
}
示例8: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (Debugger.IsAttached)
{
Log.Level = Log.LogLevel.Verbose;
}
}
示例9: OnComponentRegistrationOnActivated
private void OnComponentRegistrationOnActivated(object sender, ActivatedEventArgs<object> activation_event)
{
// compose by batch to allow for recomposition
var batch = new CompositionBatch();
batch.AddPart(activation_event.Instance);
_mefContainer.Compose(batch);
}
示例10: Application_Activated
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
ApplicationUsageHelper.OnApplicationActivated();
}
}
示例11: Application_Activated
private void Application_Activated(
object sender, ActivatedEventArgs e)
{
AnalyticsTracker.Track(
"start", "activated");
if (e.IsApplicationInstancePreserved)
{
var global = GlobalPassHandler.Instance;
global.Reset();
if (global.ShouldPromptGlobalPass)
{
var root = RootFrame;
root.Dispatcher.BeginInvoke(() =>
root.Navigate(Navigation.GetPathTo
<GlobalPassVerify>()));
}
return;
}
ThemeData.Initialize();
Cache.RestoreCache(RootFrame.Dispatcher);
}
示例12: Application_Activated
// アプリケーションがアクティブになった (前面に表示された) ときに実行されるコード
// このコードは、アプリケーションの初回起動時には実行されません
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
TenSecGameApplication.Context.Load();
}
}
示例13: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if(e.IsApplicationInstancePreserved)
System.Diagnostics.Debug.WriteLine("Activated...");
else
System.Diagnostics.Debug.WriteLine("Recovered from tombstoning, Activated...");
}
示例14: Application_Activated
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (e.IsApplicationInstancePreserved == false)
{
InitializeSDK();
}
}
示例15: Current_Activated
void Current_Activated(object sender, ActivatedEventArgs e)
{
if (deactivatedState != null)
{
player.RestoreMediaState(deactivatedState);
}
}