// Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
DisposeQueue.Instance.Initialize();
- NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
- // Populate all members of "e" (NUIApplicationInitEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationInitEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationInitEventHandler(this, e);
- }
- }
+ _applicationInitEventHandler?.Invoke(this, new NUIApplicationInitEventArgs());
}
// Callback for Application TerminateSignal
private void OnNUIApplicationTerminate(IntPtr data)
{
- NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
-
- // Populate all members of "e" (NUIApplicationTerminateEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationTerminateEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationTerminateEventHandler(this, e);
- }
- }
+ _applicationTerminateEventHandler?.Invoke(this, new NUIApplicationTerminatingEventArgs());
}
/**
// Callback for Application PauseSignal
private void OnNUIApplicationPause(IntPtr data)
{
- NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
-
- // Populate all members of "e" (NUIApplicationPauseEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationPauseEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationPauseEventHandler(this, e);
- }
- }
+ _applicationPauseEventHandler?.Invoke(this, new NUIApplicationPausedEventArgs());
}
/**
// Callback for Application ResumeSignal
private void OnNUIApplicationResume(IntPtr data)
{
- NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
-
- // Populate all members of "e" (NUIApplicationResumeEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationResumeEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationResumeEventHandler(this, e);
- }
- }
+ _applicationResumeEventHandler?.Invoke(this, new NUIApplicationResumedEventArgs());
}
/**
// Callback for Application ResetSignal
private void OnNUIApplicationReset(IntPtr data)
{
- NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
-
- // Populate all members of "e" (NUIApplicationResetEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationResetEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationResetEventHandler(this, e);
- }
- }
+ _applicationResetEventHandler?.Invoke(this, new NUIApplicationResetEventArgs());
}
/**
// Callback for Application ResizeSignal
private void OnNUIApplicationResize(IntPtr data)
{
- NUIApplicationResizedEventArgs e = new NUIApplicationResizedEventArgs();
-
- // Populate all members of "e" (NUIApplicationResizeEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationResizeEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationResizeEventHandler(this, e);
- }
- }
+ _applicationResizeEventHandler?.Invoke(this, new NUIApplicationResizedEventArgs());
}
/**
// Callback for Application LanguageChangedSignal
private void OnNUIApplicationLanguageChanged(IntPtr data)
{
- NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
-
- // Populate all members of "e" (NUIApplicationLanguageChangedEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationLanguageChangedEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationLanguageChangedEventHandler(this, e);
- }
- }
+ _applicationLanguageChangedEventHandler?.Invoke(this, new NUIApplicationLanguageChangedEventArgs());
}
/**
// Callback for Application RegionChangedSignal
private void OnNUIApplicationRegionChanged(IntPtr data)
{
- NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
-
- // Populate all members of "e" (NUIApplicationRegionChangedEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(data))
- {
- if (_applicationRegionChangedEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationRegionChangedEventHandler(this, e);
- }
- }
+ _applicationRegionChangedEventHandler?.Invoke(this, new NUIApplicationRegionChangedEventArgs());
}
/**
// Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
e.BatteryStatus = status;
-
- if (_applicationBatteryLowEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationBatteryLowEventHandler(this, e);
- }
+ _applicationBatteryLowEventHandler?.Invoke(this, e);
}
/**
// Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
e.MemoryStatus = status;
-
- if (_applicationMemoryLowEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationMemoryLowEventHandler(this, e);
- }
+ _applicationMemoryLowEventHandler?.Invoke(this, e);
}
/**
{
NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
e.VoidP = voidp;
-
- // Populate all members of "e" (NUIApplicationAppControlEventArgs) with real data
- using (e.Application = Application.GetApplicationFromPtr(application))
- {
- if (_applicationAppControlEventHandler != null)
- {
- //here we send all data to user event handlers
- _applicationAppControlEventHandler(this, e);
- }
- }
+ _applicationAppControlEventHandler?.Invoke(this, e);
}
private static Application _instance; // singleton
return null;
}
- Application ret = new Application(cPtr, false);
+ Application ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Application;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private void OnTimeTick(IntPtr application, IntPtr watchTime)
{
TimeTickEventArgs e = new TimeTickEventArgs();
- using (e.Application = Application.GetApplicationFromPtr(application))
- {
- using (e.WatchTime = WatchTime.GetWatchTimeFromPtr(watchTime))
- {
- _timeTickEventHandler?.Invoke(this, e);
- }
- }
+ e.Application = this;
+ e.WatchTime = WatchTime.GetWatchTimeFromPtr(watchTime);
+
+ _timeTickEventHandler?.Invoke(this, e);
}
{
AmbientTickEventArgs e = new AmbientTickEventArgs();
- using (e.Application = Application.GetApplicationFromPtr(application))
- {
- using (e.WatchTime = WatchTime.GetWatchTimeFromPtr(watchTime))
- {
- _ambientTickEventHandler?.Invoke(this, e);
- }
- }
+ e.Application = this;
+ e.WatchTime = WatchTime.GetWatchTimeFromPtr(watchTime);
+ _ambientTickEventHandler?.Invoke(this, e);
}
internal WatchTimeSignal AmbientTickSignal()
private void OnAmbientChanged(IntPtr application, bool changed)
{
AmbientChangedEventArgs e = new AmbientChangedEventArgs();
- using (e.Application = Application.GetApplicationFromPtr(application))
- {
- e.Changed = changed;
- _ambientChangedEventHandler?.Invoke(this, e);
- }
+ e.Application = this;
+ e.Changed = changed;
+ _ambientChangedEventHandler?.Invoke(this, e);
}
internal WatchBoolSignal AmbientChangedSignal()