当前位置: 首页>>代码示例>>C#>>正文


C# TypedEventHandler类代码示例

本文整理汇总了C#中TypedEventHandler的典型用法代码示例。如果您正苦于以下问题:C# TypedEventHandler类的具体用法?C# TypedEventHandler怎么用?C# TypedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypedEventHandler类属于命名空间,在下文中一共展示了TypedEventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;未经允许,请勿转载。