Inheritance: System.Windows.Controls.Control, INotifyPropertyChanged
Ejemplo n.º 1
0
 internal CancelCommandImpl(SignInDialog signInDialog)
 {
     _signInDialog = signInDialog;
 }
Ejemplo n.º 2
0
 internal GenerateCredentialCommandImpl(SignInDialog signInDialog)
 {
     _signInDialog = signInDialog;
 }
Ejemplo n.º 3
0
#pragma warning restore 1574

        private static void DoSignInInUIThread(string url, Action <IdentityManager.Credential, Exception> callback, IdentityManager.GenerateTokenOptions generateTokenOptions
#if !SILVERLIGHT
                                               , IdentityManager.AuthenticationType authenticationType = IdentityManager.AuthenticationType.Token
#endif
                                               )
        {
            // In SL and WPF : Create the ChildWindow that contains the SignInDialog
#if SILVERLIGHT
            ChildWindow        childWindow   = new ChildWindow();
            DependencyProperty titleProperty = ChildWindow.TitleProperty;
#else
            var childWindow = new Window
            {
                ShowInTaskbar         = false,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                WindowStyle           = WindowStyle.ToolWindow,
                SizeToContent         = SizeToContent.WidthAndHeight,
                ResizeMode            = ResizeMode.NoResize,
                WindowState           = WindowState.Normal
            };

            if (Application.Current != null && Application.Current.MainWindow != null)
            {
                try
                {
                    childWindow.Owner = Application.Current.MainWindow;
                }
                catch (Exception)
                {
                    // May fire an exception when used inside an excel or powerpoint addins
                }
            }

            DependencyProperty titleProperty = Window.TitleProperty;
#endif

            // Create the SignInDialog with the parameters given as arguments
            var signInDialog = new SignInDialog
            {
                Url      = url,
                Callback = (credential, error) =>
                {
                    childWindow.Close();
                    callback(credential, error);
                },
                GenerateTokenOptions = generateTokenOptions,
                IsActive             = true,
                Width = 300,
#if !SILVERLIGHT
                _authenticationType = authenticationType
#endif
            };

            childWindow.Content = signInDialog;

            // Bind the Title so the ChildWindow Title is the SignInDialog title (taht will be initialized later)
            Binding binding = new Binding("Title")
            {
                Source = signInDialog
            };
            childWindow.SetBinding(titleProperty, binding);
            childWindow.Closed += (s, e) => signInDialog.IsActive = false;             // be sure the SignInDialog is deactivated (i.e. Callback executed once) when closing the childwindow using the X
            // Show the window
#if SILVERLIGHT
            childWindow.Show();
#else
            childWindow.ShowDialog();
#endif
        }
Ejemplo n.º 4
0
			internal CancelCommandImpl(SignInDialog signInDialog)
			{
				_signInDialog = signInDialog;
			}
Ejemplo n.º 5
0
			internal GenerateCredentialCommandImpl(SignInDialog signInDialog)
			{
				_signInDialog = signInDialog;
			}
Ejemplo n.º 6
0
#pragma warning restore 1574

		private static void DoSignInInUIThread(string url, Action<IdentityManager.Credential, Exception> callback, IdentityManager.GenerateTokenOptions generateTokenOptions
#if !SILVERLIGHT
			, IdentityManager.AuthenticationType authenticationType = IdentityManager.AuthenticationType.Token
#endif
			)
		{
			// In SL and WPF : Create the ChildWindow that contains the SignInDialog
#if SILVERLIGHT
			ChildWindow childWindow = new ChildWindow();
			DependencyProperty titleProperty = ChildWindow.TitleProperty;
#else
			var childWindow = new Window
			{
				ShowInTaskbar = false,
				WindowStartupLocation = WindowStartupLocation.CenterOwner,
				WindowStyle = WindowStyle.ToolWindow,
				SizeToContent = SizeToContent.WidthAndHeight,
				ResizeMode = ResizeMode.NoResize,
				WindowState = WindowState.Normal
			};

			if (Application.Current != null && Application.Current.MainWindow != null)
			{
				try
				{
					childWindow.Owner = Application.Current.MainWindow;
				}
				catch (Exception)
				{
					// May fire an exception when used inside an excel or powerpoint addins
				}
			}

			DependencyProperty titleProperty = Window.TitleProperty;
#endif

			// Create the SignInDialog with the parameters given as arguments
			var signInDialog = new SignInDialog
			{
				Url = url,
				Callback = (credential, error) =>
				{
					childWindow.Close();
					callback(credential, error);
				},
				GenerateTokenOptions = generateTokenOptions,
				IsActive = true,
				Width = 300,
#if !SILVERLIGHT
				_authenticationType = authenticationType
#endif
			};

			childWindow.Content = signInDialog;

			// Bind the Title so the ChildWindow Title is the SignInDialog title (taht will be initialized later)
			Binding binding = new Binding("Title") { Source = signInDialog };
			childWindow.SetBinding(titleProperty, binding);
			childWindow.Closed += (s, e) => signInDialog.IsActive = false; // be sure the SignInDialog is deactivated (i.e. Callback executed once) when closing the childwindow using the X
			// Show the window
#if SILVERLIGHT
			childWindow.Show();
#else
			childWindow.ShowDialog();
#endif
		}