/// <summary> /// Constructs a new <see cref="InteractiveAuthenticationProvider"/> /// </summary> /// <param name="publicClientApplication">A <see cref="IPublicClientApplication"/> to pass to <see cref="InteractiveAuthenticationProvider"/> for authentication.</param> /// <param name="scopes">Scopes required to access Microsoft Graph. This defaults to https://graph.microsoft.com/.default when none is set.</param> /// <param name="prompt">Designed interactive experience for the user. Defaults to <see cref="Prompt.SelectAccount"/>.</param> /// <param name="window">Object containing a reference to the parent window/activity.</param> /// <param name="pointer">Object containing a reference to the parent window/activity.</param> public InteractiveAuthenticationProvider( IPublicClientApplication publicClientApplication, IEnumerable <string> scopes = null, Prompt?prompt = null, System.Windows.Forms.IWin32Window window = null, IntPtr pointer = default(IntPtr)) { Scopes = scopes ?? new List <string> { AuthConstants.DefaultScopeUrl }; if (Scopes.Count() == 0) { throw new AuthenticationException( new Error { Code = ErrorConstants.Codes.InvalidRequest, Message = ErrorConstants.Message.EmptyScopes }, new ArgumentException()); } ClientApplication = publicClientApplication ?? throw new AuthenticationException( new Error { Code = ErrorConstants.Codes.InvalidRequest, Message = string.Format(ErrorConstants.Message.NullValue, nameof(publicClientApplication)) }); Prompt = prompt ?? Prompt.SelectAccount; ParentWindow = window; ParentPointer = pointer; }
private void InitializeLegend() { legend.Children.Clear(); int amount = 0; for (int i = 0; i < Scopes.Count(); i++) { if (Scopes[i].Sum != 0) //Initialize LegendItems only for not empty Pies { var legendItem = new PieLegendItem(amount, UsersBrushes[amount], Scopes[i].EnumMember.Item); amount++; legendItem.MouseOn += LegendItem_MouseOn; legendItem.MouseOut += LegendItem_MouseOut; legend.Children.Add(legendItem); } } }
private void InitializePiePieces() { var generalVol = Scopes.TotalSum; var genAngle = 0.0; for (int i = 0; i < Scopes.Count(); i++) { if (Scopes[i].Sum != 0) { var angle = Convert.ToDouble((Scopes[i].Sum * FullAngle) / generalVol); var piePiece = new PiePiece(Scopes[i].EnumMember, angle, UsersBrushes[i]); piePiece.MouseIn += PiePiece_MouseIn; piePiece.MouseOut += PiePiece_MouseOut; piePiece.Rotate(genAngle); genAngle += angle; piePieces.Add(piePiece); PiecesGrid.Children.Add(piePiece); } } }
/// <summary> /// Constructs a new <see cref="DeviceCodeProvider"/> /// </summary> /// <param name="publicClientApplication">A <see cref="IPublicClientApplication"/> to pass to <see cref="DeviceCodeProvider"/> for authentication.</param> /// <param name="scopes">Scopes required to access Microsoft Graph. This defaults to https://graph.microsoft.com/.default when none is set.</param> /// <param name="deviceCodeResultCallback">Callback containing information to show the user about how to authenticate and enter the device code.</param> public DeviceCodeProvider(IPublicClientApplication publicClientApplication, IEnumerable <string> scopes = null, Func <DeviceCodeResult, Task> deviceCodeResultCallback = null) { Scopes = scopes ?? new List <string> { AuthConstants.DefaultScopeUrl }; if (Scopes.Count() == 0) { throw new AuthenticationException( new Error { Code = ErrorConstants.Codes.InvalidRequest, Message = ErrorConstants.Message.EmptyScopes }, new ArgumentException()); } ClientApplication = publicClientApplication ?? throw new AuthenticationException( new Error { Code = ErrorConstants.Codes.InvalidRequest, Message = string.Format(ErrorConstants.Message.NullValue, nameof(publicClientApplication)) }); DeviceCodeResultCallback = deviceCodeResultCallback ?? (async(result) => await Console.Out.WriteLineAsync(result.Message)); }