/// <summary> /// Initializes a new instance of the <see cref="AcceptStationDialog"/> class. /// Constructor /// </summary> /// <param name="ip"> /// the IP address of the station to accept /// </param> /// <param name="ui"> /// the UIHandler for this UI /// </param> public AcceptStationDialog(IPEndPoint ip, UiHandler ui) { _ui = ui; _ip = ip; InitializeComponent(); StationLabel.Content = StationLabel.Content.ToString().Replace("NAME", _ui.IdentifyingStringForStation(ip)); Activate(); PwTextbox.Focus(); OKButton.IsEnabled = false; Title = "Accept Station"; }
/// <summary> /// This will be called when a manager wants to connect to this station. /// Accessable via UIHandler.ManagerExchangingKey(IPEndPoint ip) /// </summary> /// <param name="ip"> /// the ip adress of the manager /// </param> /// <returns> /// the password typed on the station /// </returns> public string IncomingConnection(IPEndPoint ip) { Boolean result = false; _ui._stationWindow.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action( delegate { var amd = new AcceptManagerDialog(_parent, _ui.IdentifyingStringForStation(ip), this); amd.Owner = _ui._stationWindow; result = (Boolean)amd.ShowDialog(); })); if (result) { CenterLabel.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate { CenterLabel.Content = "Waiting for election data..."; })); return(TypedPassword); } return(string.Empty); }