本文整理汇总了C#中TypedEventHandler类的典型用法代码示例。如果您正苦于以下问题:C# TypedEventHandler类的具体用法?C# TypedEventHandler怎么用?C# TypedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypedEventHandler类属于命名空间,在下文中一共展示了TypedEventHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RegisterBackKey
/// <summary>Call this method in Loaded event as the event will be automatically
/// deregistered when the FrameworkElement has been unloaded. </summary>
public static void RegisterBackKey(Page page)
{
var callback = new TypedEventHandler<CoreDispatcher, AcceleratorKeyEventArgs>(
delegate(CoreDispatcher sender, AcceleratorKeyEventArgs args)
{
if (!args.Handled && args.VirtualKey == VirtualKey.Back &&
(args.EventType == CoreAcceleratorKeyEventType.KeyDown ||
args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown))
{
var element = FocusManager.GetFocusedElement();
if (element is FrameworkElement && PopupHelper.IsInPopup((FrameworkElement)element))
return;
if (element is TextBox || element is PasswordBox || element is WebView)
return;
if (page.Frame.CanGoBack)
{
args.Handled = true;
page.Frame.GoBack();
}
}
});
page.Dispatcher.AcceleratorKeyActivated += callback;
SingleEvent.RegisterEvent(page,
(p, h) => p.Unloaded += h,
(p, h) => p.Unloaded -= h,
(o, a) => { page.Dispatcher.AcceleratorKeyActivated -= callback; });
}
开发者ID:RareNCool,项目名称:MyToolkit,代码行数:33,代码来源:PageUtilities.cs
示例2: MainPage
public MainPage()
{
this.InitializeComponent();
NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;
AppCallbacks appCallbacks = AppCallbacks.Instance;
// Setup scripting bridge
_bridge = new WinRTBridge.WinRTBridge();
appCallbacks.SetBridge(_bridge);
appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };
#if !UNITY_WP_8_1
appCallbacks.SetKeyboardTriggerControl(this);
#endif
appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
appCallbacks.InitializeD3DXAML();
splash = ((App)App.Current).splashScreen;
GetSplashBackgroundColor();
OnResize();
onResizeHandler = new WindowSizeChangedEventHandler((o, e) => OnResize());
Window.Current.SizeChanged += onResizeHandler;
#if UNITY_WP_8_1
onRotationChangedHandler = new TypedEventHandler<DisplayInformation, object>((di, o) => { OnRotate(di); });
ExtendedSplashImage.RenderTransformOrigin = new Point(0.5, 0.5);
var displayInfo = DisplayInformation.GetForCurrentView();
displayInfo.OrientationChanged += onRotationChangedHandler;
OnRotate(displayInfo);
SetupLocationService();
#endif
}
开发者ID:Myfreedom614,项目名称:UWP-Samples,代码行数:35,代码来源:MainPage.xaml.cs
示例3: GeofencingService
public GeofencingService(TypedEventHandler<GeofenceMonitor, object> stateChange, TypedEventHandler<GeofenceMonitor, object> statusChanged, CoreDispatcher dispatcher)
{
Messenger.Default.Register<SetupGeofencingMessage>(this, async message => await SetupGeofencesAsync(message));
this.stateChange = stateChange;
this.statusChanged = statusChanged;
this.dispatcher = dispatcher;
}
开发者ID:robertiagar,项目名称:perimetr,代码行数:7,代码来源:GeofencingService.cs
示例4: DbControllerQueryAttributeChecker
/// <summary>
/// Initializes a new instance of the <see cref="DbControllerQueryAttributeChecker"/> class.
/// </summary>
/// <param name="missingAttributeHandler">The event handler for types with missing attributes.
/// Cannot be null.</param>
/// <exception cref="ArgumentNullException"><paramref name="missingAttributeHandler"/> is null.</exception>
/// <param name="typesToIgnore">Optional array of types to ignore. If a type is in this collection, it will
/// never be invoked by the <paramref name="missingAttributeHandler"/>.</param>
public DbControllerQueryAttributeChecker(
TypedEventHandler<DbControllerQueryAttributeChecker, EventArgs<Type>> missingAttributeHandler,
params Type[] typesToIgnore)
{
if (missingAttributeHandler == null)
throw new ArgumentNullException("missingAttributeHandler");
_missingAttributeHandler = missingAttributeHandler;
_typesToIgnore = typesToIgnore;
var filter = new TypeFilterCreator
{
IsClass = true,
IsAbstract = false,
IsInterface = false,
RequireAttributes = false,
Interfaces = new Type[] { typeof(IDbQuery) },
MatchAllInterfaces = true,
RequireInterfaces = false,
RequireConstructor = false,
IsEnum = false
};
new TypeFactory(filter.GetFilter(), LoadTypeHandler);
}
开发者ID:wtfcolt,项目名称:game,代码行数:33,代码来源:DbControllerQueryAttributeChecker.cs
示例5: MainWindow
/// <summary>
/// Constructor initializes necessary variables and reads in saved constraints from text file.
/// </summary>
public MainWindow()
{
InitializeComponent();
string fileName = @"Stored_Constraints.txt";
Debug.WriteLine(DateTime.Now.ToString());
filePath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), fileName);
dateTimesForConstraints = new Dictionary<string, string>();
backgroundListener = new SpeechRecognizer();
constraints = new List<string>();
BLResultGenerated = new TypedEventHandler<SpeechContinuousRecognitionSession, SpeechContinuousRecognitionResultGeneratedEventArgs>(blResultGenerated);
backgroundListener.ContinuousRecognitionSession.ResultGenerated += BLResultGenerated;
constraints = readInConstraintsFromFile();
currentlyStoredConstraints = constraints.ToList();
updateConstraintsWindow(constraints);
this.Closing += OnAppClosing;
var waitOn = loadOnStart();
while (waitOn.Status != AsyncStatus.Completed) { }
var ff = backgroundListener.ContinuousRecognitionSession.StartAsync();
notifyIcon = new NotifyIcon();
notifyIcon.Icon = new System.Drawing.Icon("trayImage.ico");
notifyIcon.Visible = true;
notifyIcon.DoubleClick +=
delegate (object sender, EventArgs args)
{
this.Show();
this.WindowState = WindowState.Normal;
};
}
开发者ID:jerryh91,项目名称:CortanaCommandExtension,代码行数:37,代码来源:MainWindow.xaml.cs
示例6: OnProviderChanged
private static void OnProviderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var searchBox = (SearchBox)d;
CleanSuggestionRequestedEventHandlers(searchBox);
var eventHandler = new TypedEventHandler<SearchBox, SearchBoxSuggestionsRequestedEventArgs>(searchBox_SuggestionsRequested);
_suggestionRequestedEventHandlers.Add(searchBox, eventHandler);
searchBox.SuggestionsRequested += eventHandler;
}
开发者ID:Galad,项目名称:Hanno,代码行数:8,代码来源:SearchBoxProperties.cs
示例7: RegisterAcceleratorKeyActivated
/// <summary>Call this method in Loaded event as the event will be automatically
/// deregistered when the FrameworkElement has been unloaded. </summary>
/// <param name="page">The page. </param>
/// <param name="handler">The event handler. </param>
public static void RegisterAcceleratorKeyActivated(FrameworkElement page, TypedEventHandler<CoreDispatcher, AcceleratorKeyEventArgs> handler)
{
page.Dispatcher.AcceleratorKeyActivated += handler;
SingleEvent.RegisterEvent(page, (p, h) => p.Unloaded += h, (p, h) => p.Unloaded -= h, (o, a) =>
{
page.Dispatcher.AcceleratorKeyActivated -= handler;
});
}
开发者ID:RareNCool,项目名称:MyToolkit,代码行数:12,代码来源:PageUtilities.cs
示例8: newProc
/*public static class myGlobals
{
public static int procNum { get; private set; }
public static void newProc(int i)
{
procNum = i;
}
}*/
public MainPage()
{
this.InitializeComponent();
InitSettings();
m_mediaPropertyChanged = new TypedEventHandler<SystemMediaTransportControls, SystemMediaTransportControlsPropertyChangedEventArgs>(SystemMediaControls_PropertyChanged);
EnumerateWebcamsAsync();
startDevice();
showCam();
}
开发者ID:IntelisoftDev,项目名称:DocScanDemo,代码行数:19,代码来源:MainPage.xaml.cs
示例9: RegisterShaken
private void RegisterShaken()
{
shakenHandler = new TypedEventHandler<Accelerometer, AccelerometerShakenEventArgs>(OnShaken);
accelerometer = Accelerometer.GetDefault();
if (accelerometer != null)
{
accelerometer.Shaken += shakenHandler;
}
}
开发者ID:kiewic,项目名称:Questions,代码行数:9,代码来源:App.xaml.cs
示例10: SendToastWithActionNotification
public static void SendToastWithActionNotification(string toastXML, TypedEventHandler<ToastNotification, System.Object> toastActived)
{
Windows.Data.Xml.Dom.XmlDocument badgeDOM = new Windows.Data.Xml.Dom.XmlDocument();
badgeDOM.LoadXml(toastXML);
ToastNotification toast = new ToastNotification(badgeDOM);
if (toastActived != null)
{
toast.Activated += toastActived;
}
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
开发者ID:JamborYao,项目名称:UwpStart,代码行数:11,代码来源:Notifications.cs
示例11: Show
public static void Show(
string title,
string message = null,
string furtherMessage = null,
TypedEventHandler<ToastNotification, object> onActivate = null,
TypedEventHandler<ToastNotification, ToastDismissedEventArgs> onDismiss = null)
{
// Get a toast XML template
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);
// Fill in the text elements
var stringElements = toastXml.GetElementsByTagName("text");
var textIndex = 0;
//Add the title
stringElements[textIndex].AppendChild(toastXml.CreateTextNode(title));
textIndex++;
//Add the message
if (!string.IsNullOrEmpty(message))
{
stringElements[textIndex].AppendChild(toastXml.CreateTextNode(message));
textIndex++;
}
//Add the further message
if (!string.IsNullOrEmpty(furtherMessage))
{
stringElements[textIndex].AppendChild(toastXml.CreateTextNode(furtherMessage));
}
// Specify the absolute path to an image
var imagePath = "file:///" + Path.GetFullPath("Resources/logo_512.png");
var imageElements = toastXml.GetElementsByTagName("image");
var namedItem = imageElements[0].Attributes.GetNamedItem("src");
if (namedItem != null)
namedItem.NodeValue = imagePath;
var toast = new ToastNotification(toastXml);
if (onActivate != null)
{
toast.Activated += onActivate;
}
if (onDismiss != null)
{
toast.Dismissed += onDismiss;
}
ToastNotificationManager.CreateToastNotifier(AppId).Show(toast);
}
开发者ID:anth12,项目名称:ReVersion,代码行数:53,代码来源:NotificationHelper.cs
示例12: MainWindow
public MainWindow()
{
InitializeComponent();
recognizer = new SpeechRecognizer();
List<String> constraints = new List<string>();
//recognizer.Constraints.Add(new SpeechRecognitionListConstraint(constraints));
IAsyncOperation<SpeechRecognitionCompilationResult> op = recognizer.CompileConstraintsAsync();
resultGenerated = new TypedEventHandler<SpeechContinuousRecognitionSession, SpeechContinuousRecognitionResultGeneratedEventArgs>(UpdateTextBox);
recognizer.ContinuousRecognitionSession.ResultGenerated += resultGenerated;
OnStateChanged = new TypedEventHandler<SpeechRecognizer, SpeechRecognizerStateChangedEventArgs>(onStateChanged);
recognizer.StateChanged += OnStateChanged;
op.Completed += HandleCompilationCompleted;
}
开发者ID:kirocuto,项目名称:CortanaCommandExtension,代码行数:14,代码来源:MainWindow.xaml.cs
示例13: ScannerPage
public ScannerPage()
{
InitializeComponent();
int ver = Scanner.MWBgetLibVersion();
int v1 = (ver >> 16);
int v2 = (ver >> 8) & 0xff;
int v3 = (ver & 0xff);
libVersion = String.Format("{0}.{1}.{2}", v1, v2, v3);
System.Diagnostics.Debug.WriteLine("Lib version: " + libVersion);
processingHandler = new DoWorkEventHandler(bw_DoWork);
previewFrameHandler = new TypedEventHandler<ICameraCaptureDevice, Object>(cam_PreviewFrameAvailable);
bw.WorkerReportsProgress = false;
bw.WorkerSupportsCancellation = true;
bw.DoWork += processingHandler;
}
开发者ID:johannady2,项目名称:glogdirect,代码行数:23,代码来源:ScannerPage.xaml.cs
示例14: OnNavigatedTo
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
dataChangedHandler = new TypedEventHandler<ApplicationData, object>(DataChangedHandler);
applicationData.DataChanged += dataChangedHandler;
}
开发者ID:badreddine-dlaila,项目名称:Windows-8.1-Universal-App,代码行数:10,代码来源:Scenario6_HighPriority.xaml.cs
示例15: RegisterForDeviceAccessStatusChange
/// <summary>
/// Listen for any changed in device access permission. The user can block access to the device while the device is in use.
/// If the user blocks access to the device while the device is opened, the device's handle will be closed automatically by
/// the system; it is still a good idea to close the device explicitly so that resources are cleaned up.
///
/// Note that by the time the AccessChanged event is raised, the device handle may already be closed by the system.
/// </summary>
private void RegisterForDeviceAccessStatusChange()
{
deviceAccessInformation = DeviceAccessInformation.CreateFromId(deviceInformation.Id);
deviceAccessEventHandler = new TypedEventHandler<DeviceAccessInformation, DeviceAccessChangedEventArgs>(this.OnDeviceAccessChanged);
deviceAccessInformation.AccessChanged += deviceAccessEventHandler;
}
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:14,代码来源:EventHandlerForDevice.cs
示例16: RegisterForDeviceWatcherEvents
/// <summary>
/// Register for Added and Removed events.
/// Note that, when disconnecting the device, the device may be closed by the system before the OnDeviceRemoved callback is invoked.
/// </summary>
private void RegisterForDeviceWatcherEvents()
{
deviceAddedEventHandler = new TypedEventHandler<DeviceWatcher, DeviceInformation>(this.OnDeviceAdded);
deviceRemovedEventHandler = new TypedEventHandler<DeviceWatcher, DeviceInformationUpdate>(this.OnDeviceRemoved);
deviceWatcher.Added += deviceAddedEventHandler;
deviceWatcher.Removed += deviceRemovedEventHandler;
}
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:14,代码来源:EventHandlerForDevice.cs
示例17: Show
public void Show()
{
Rect bounds = Window.Current.Bounds;
var child = (FrameworkElement)_popupView;
_popup = new Popup
{
Width = bounds.Width,
Height = bounds.Height,
Child = child,
IsLightDismissEnabled = false,
ChildTransitions =
new TransitionCollection
{
new PopupThemeTransition {FromHorizontalOffset = 0, FromVerticalOffset = 100}
}
};
InputPane inputPane = InputPane.GetForCurrentView();
if (inputPane != null)
_flyoutOffset = inputPane.OccludedRect.Height;
_settings = new PopupSettings
{
UpdatePositionAction = UpdatePositionDelegate,
UpdateSizeAction = UpdateSizeDelegate
};
_popupView.InitializePopup(_popup, _settings);
UpdatePopup(bounds.Width, bounds.Height);
_popup.Closed += PopupOnClosed;
if (_settings.ShowAction == null)
_popup.IsOpen = true;
else
_settings.ShowAction(_popup);
_weakSizeListener = ReflectionExtensions
.CreateWeakDelegate<PopupWrapper, WindowSizeChangedEventArgs, WindowSizeChangedEventHandler>(
this, (wrapper, o, arg3) => wrapper.OnWindowSizeChanged(arg3), (o, handler) => ((Window)o).SizeChanged -= handler, handler => handler.Handle);
Window.Current.SizeChanged += _weakSizeListener;
if (inputPane != null)
{
_weakInputPaneListener = ReflectionExtensions
.CreateWeakDelegate<PopupWrapper, InputPaneVisibilityEventArgs,
TypedEventHandler<InputPane, InputPaneVisibilityEventArgs>>(this,
(wrapper, o, arg3) => wrapper.OnInputPaneChanged(arg3),
(o, handler) =>
{
var pane = (InputPane)o;
pane.Hiding -= handler;
pane.Showing -= handler;
}, handler => handler.Handle);
inputPane.Showing += _weakInputPaneListener;
inputPane.Hiding += _weakInputPaneListener;
}
}
开发者ID:MuffPotter,项目名称:MugenMvvmToolkit,代码行数:52,代码来源:PlatformWrapperRegistrationModule.cs
示例18: StartWatcher
void StartWatcher()
{
//deviceWatcher = DeviceInformation.CreateWatcher(UsbDevice.GetDeviceSelector(0x04d8, 0xf426));
deviceWatcher = DeviceInformation.CreateWatcher(UsbDevice.GetDeviceSelector(TreehopperUsb.Settings.Vid, TreehopperUsb.Settings.Pid));
// Hook up handlers for the watcher events before starting the watcher
handlerAdded = new TypedEventHandler<DeviceWatcher, DeviceInformation>(async (watcher, deviceInfo) =>
{
Debug.WriteLine("Device added: " + deviceInfo.Name);
UsbConnection newConnection = new UsbConnection(deviceInfo);
TreehopperUsb newBoard = new TreehopperUsb(newConnection);
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
connectedDevices.Add(newBoard);
});
try
{
if (boardAddedSignal.CurrentCount == 0)
boardAddedSignal.Release();
}
catch { }
});
deviceWatcher.Added += handlerAdded;
handlerUpdated = new TypedEventHandler<DeviceWatcher, DeviceInformationUpdate>((watcher, deviceInfoUpdate) =>
{
Debug.WriteLine("Device updated");
});
deviceWatcher.Updated += handlerUpdated;
handlerRemoved = new TypedEventHandler<DeviceWatcher, DeviceInformationUpdate>(async (watcher, deviceInfoUpdate) =>
{
Debug.WriteLine("Device removed");
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
connectedDevices.Where(board => ((UsbConnection)(board.Connection)).DevicePath == deviceInfoUpdate.Id).ToList().All(i =>
{
i.Disconnect();
connectedDevices.Remove(i);
return true;
}
);
});
});
deviceWatcher.Removed += handlerRemoved;
handlerEnumCompleted = new TypedEventHandler<DeviceWatcher, Object>((watcher, obj) =>
{
Debug.WriteLine("Enum completed");
});
deviceWatcher.EnumerationCompleted += handlerEnumCompleted;
handlerStopped = new TypedEventHandler<DeviceWatcher, Object>((watcher, obj) =>
{
Debug.WriteLine("Device or something stopped");
});
deviceWatcher.Stopped += handlerStopped;
Debug.WriteLine("Starting the wutchah");
deviceWatcher.Start();
}
开发者ID:treehopper-electronics,项目名称:treehopper-sdk,代码行数:63,代码来源:ConnectionService.cs
示例19: DetachEvent
private void DetachEvent(TypedEventHandler<Accelerometer, AccelerometerReadingChangedEventArgs> ev)
{
_accelero.ReportInterval = 0;
_accelero.ReadingChanged -= ev;
}
开发者ID:bzshang,项目名称:PINSly,代码行数:5,代码来源:AccelerometerProvider.cs
示例20: Page_Loaded
private void Page_Loaded(object sender, RoutedEventArgs e)
{
object apiKey = null;
if (Windows.Storage.ApplicationData.Current.RoamingSettings.Values.TryGetValue("FlickrApiKey", out apiKey))
{
FlickrApiKey.Text = (string)apiKey;
}
object username = null;
if (Windows.Storage.ApplicationData.Current.RoamingSettings.Values.TryGetValue("FlickrUsername", out username))
{
FlickrUsername.Text = (string)username;
}
if (_displayHandler == null)
{
_displayHandler = Page_OrientationChanged;
_layoutHandler = Page_LayoutChanged;
}
DisplayProperties.OrientationChanged += _displayHandler;
ApplicationLayout.GetForCurrentView().LayoutChanged += _layoutHandler;
SetCurrentOrientation(this);
}
开发者ID:sourcebits-shaik,项目名称:MetroFlickr,代码行数:25,代码来源:Settings.xaml.cs
注:本文中的TypedEventHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论