Inheritance: INotifyPropertyChanged
Esempio n. 1
0
 internal RosterElement(Attendance attendance)
 {
     InitializeComponent();
     Attendance = attendance;
     ToolTip = "Chat with " + attendance.Party.Firstname;
     IsCurrent = false;
 }
Esempio n. 2
0
        private void FadeRosterElement(Attendance attendance)
        {
            var listItem = _listBox.ItemContainerGenerator.ContainerFromItem(attendance) as ListBoxItem;
            if (listItem != null)
            {
                //var animation = new DoubleAnimation(1.0, 0.0, new TimeSpan(0, 0, 0, 1, 300));
                var animation2 = new DoubleAnimation(65, 0, new TimeSpan(0, 0, 0, 0, 1000))
                {
                    FillBehavior = FillBehavior.Stop,
                    BeginTime = new TimeSpan(0, 0, 0, 0, 3000),
                    AccelerationRatio = 0.3,
                    DecelerationRatio = 0.6,
                };
                //animation.Completed += (sender, args) => rosterElement.BeginAnimation(Grid.HeightProperty, animation2);
                animation2.Completed += (o, args) =>
                {
                    listItem.BeginAnimation(UIElement.OpacityProperty, null);
                    RefreshRoster();
                };
                Logger.Debug("Fading element");
                //listItem.BeginAnimation(UIElement.OpacityProperty, animation);
                listItem.BeginAnimation(FrameworkElement.HeightProperty, animation2);

            }
        }
Esempio n. 3
0
 internal void MarkRoster(Attendance attendance, bool markActive = false)
 {
     var element = _listBox.ItemContainerGenerator.ContainerFromItem(attendance) as ListBoxItem;
     if (element != null && element.IsSelected == false)
     {
         element.IsSelected = true;
     }
 }
Esempio n. 4
0
 internal Engagement(GwupeClientAppContext appContext, Attendance personAttendance)
 {
     this._appContext = appContext;
     Interactions = new Interactions(this);
     // This is to pickup logouts/connection disconnections
     _appContext.LoginManager.LoggedOut += LogoutOccurred;
     SecondParty = personAttendance;
     _countdownToDeactivation = new Timer(TimeoutToTunnelClose) { AutoReset = false };
     _countdownToDeactivation.Elapsed += (sender, args) => CompleteDeactivation();
     //_transportManager = new TransportManager();
     // Setup the functions of this engagement
     Functions = new Dictionary<string, IFunction>
         {
             {"Chat", new Functions.Chat.Function(_appContext,this)},
             {"FileSend", new  Functions.FileSend.Function(_appContext, this)},
             {"RemoteDesktop", new Functions.RemoteDesktop.Function(_appContext, this)},
         };
     Functions.Values.ToList().ForEach(function =>
     {
         function.Activate += (sender, args) => { Active = true; };
         function.Deactivate += (sender, args) => SuggestCountdownToDeactivation();
     });
 }
Esempio n. 5
0
 protected ClientImpl(Attendance secondParty)
 {
     SecondParty = secondParty;
 }
Esempio n. 6
0
 public void AddAdHocPerson(Party party, String shortCode)
 {
     var attendance = new Attendance(party);
     var presence = Presence.AlwaysOn;
     presence.Resource = "_blitsme-" + shortCode;
     presence.ShortCode = shortCode;
     attendance.PropertyChanged += MarkUnmarkCurrentlyEngaged;
     attendance.SetPresence(presence);
     ServicePartyAttendanceList.Add(attendance);
     ServicePartyAttendanceLookup[attendance.Party.Username] = attendance;
 }
Esempio n. 7
0
 private void AddPartyToList(Party party, Presence presence)
 {
     var attendance = new Attendance(party);
     attendance.PropertyChanged += MarkUnmarkCurrentlyEngaged;
     if (presence != null)
     {
         attendance.SetPresence(presence);
     }
     ServicePartyAttendanceList.Add(attendance);
     ServicePartyAttendanceLookup[attendance.Party.Username] = attendance;
 }
Esempio n. 8
0
 internal Client(Attendance secondParty)
     : base(secondParty)
 {
 }
Esempio n. 9
0
 internal ISocket GetP2PConnection(Attendance secondParty, String connectionId)
 {
     // At this stage, we only support direct connections
     return InitP2PConnection(secondParty, connectionId);
 }
Esempio n. 10
0
        // Called by local application to initialise a p2p connection to a second party
        private ISocket InitP2PConnection(Attendance secondParty, String connectionId)
        {
            var initRq = new InitP2PConnectionRq { shortCode = secondParty.ActiveShortCode, connectionId = connectionId };
            TunnelEndpointContainer pendingTunnel;
            try
            {
                var response = GwupeClientAppContext.CurrentAppContext.ConnectionManager.Connection.Request<InitP2PConnectionRq, InitP2PConnectionRs>(initRq);
                // this will cause the server to initialise a tunnel endpoint and prepare it for connection
            #if DEBUG
                Logger.Debug("Got response from p2p connection request");
            #endif
                try
                {
                    pendingTunnel = GetPendingTunnel(response.uniqueId);

                    // setup my peers endpoints
                    var peer = GetPeerInfoFromResponse(response);
                    peer.FacilitatorRepeatedEndPoint = pendingTunnel.FacilitatorEndPoint;
                    pendingTunnel.TunnelEndpoint.Sync(peer, response.uniqueId, GwupeClientAppContext.CurrentAppContext.SettingsManager.SyncTypes);
                    Logger.Info("Successfully completed outgoing tunnel with " + secondParty.Party.Username + "-" + secondParty.ActiveShortCode + " [" + response.uniqueId + "]");
                }
                catch (Exception e)
                {
                    Logger.Error("Failed to sync with peer : " + e.Message, e);
                    ThreadPool.QueueUserWorkItem(m => GwupeClientAppContext.CurrentAppContext.SubmitFaultReport(
                        new FaultReport()
                        {
                            Subject = "Sync error",
                            UserReport = "INTERNAL : Failed to sync with peer : " + e.Message
                        }));
                    throw new Exception("Failed to sync with peer : " + e.Message, e);
                }
            }
            catch (Exception e)
            {
                Logger.Error("Failed to setup P2P Connection : " + e.Message, e);
                ThreadPool.QueueUserWorkItem(m => GwupeClientAppContext.CurrentAppContext.SubmitFaultReport(
                    new FaultReport()
                    {
                        Subject = "P2P setup error [" + connectionId + "]",
                        UserReport = "INTERNAL : Failed to setup p2p connection  [" + connectionId + "]: " + e.Message
                    }));
                throw new Exception("Failed to setup P2P Connection : " + e.Message, e);
            }
            return pendingTunnel.TunnelEndpoint;
        }
Esempio n. 11
0
 private void ShowEngagement(Attendance attendance)
 {
     if (!Dispatcher.CheckAccess())
     {
         Dispatcher.Invoke(new Action(() => ShowEngagement(attendance)));
     }
     else
     {
         EngagementWindow egw = _engagementWindows.GetEngagementWindow(attendance);
         if (egw != null)
         {
             attendance.IsCurrentlyEngaged = true;
             ActiveContent.Content = egw;
             egw.SetAsMain(this);
             egw.ShowChat();
         }
         else
         {
             Logger.Error("Failed to find an engagement window for " + attendance.Party);
         }
     }
 }
Esempio n. 12
0
 internal void ActivateEngagement(Attendance attendance)
 {
     if (attendance != null)
     {
         ShowEngagement(attendance);
         if (!attendance.Engagement.Active)
         {
             attendance.Engagement.Active = true;
             attendance.Engagement.Interactions.StartInteraction();
             RefreshRosters();
         }
     }
 }
Esempio n. 13
0
 internal FileSendClient(Attendance secondParty, FileSendInfo fileInfo)
     : base(secondParty)
 {
     _fileInfo = fileInfo;
 }