コード例 #1
0
        /// <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)
        {
            var amd    = new AcceptManagerDialog(_parent, ip, this);
            var result = amd.ShowDialog();

            if (result.HasValue && result == true)
            {
                CenterLabel.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate { CenterLabel.Content = "Venter på at valget starter..."; }));
                return(TypedPassword);
            }
            return("");
        }
コード例 #2
0
        /// <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);
        }