public ClientMainWindow(Client client, bool createNewInstance)
        {
            callingService = new CallingService(new IPEndPoint(client.LocalIP, port));

            friendsListGrid = new FriendsList(client, callingService);
            settingsGrid    = new ClientSettingsUserControl(client, callingService, this);
            guideGrid       = new GuideUserControl();

            if (!createNewInstance)
            {
                this.client = client;

                client.AddItemEvent    += AddOnlineUser;
                client.RemoveItemEvent += RemoveOnlineUser;

                client.AddFriendEvent    += AddFriendToObsCollection;
                client.RemoveFriendEvent += RemoveFriendToObsCollection;

                client.ConnectionLostEvent += LeaveServer;
                //client.SetProfileText += UpdateProfileEmail;
                client.AddSearchEvent += AddSearchUser;
            }
            else
            {
                this.client = new Client()
                {
                    client      = client.client,
                    LocalIP     = client.LocalIP,
                    IsConnected = true,
                    Port        = client.Port,
                    IPAddress   = client.IPAddress,
                    UserProfile = client.UserProfile
                };

                this.client.AddFriendEvent    += AddFriendToObsCollection;
                this.client.RemoveFriendEvent += RemoveFriendToObsCollection;

                this.client.AddItemEvent    += AddOnlineUser;
                this.client.RemoveItemEvent += RemoveOnlineUser;

                this.client.ConnectionLostEvent += LeaveServer;
                //this.client.SetProfileText += UpdateProfileEmail;
                this.client.AddSearchEvent += AddSearchUser;
            }

            InitializeComponent();
            client.StartListening();

            InitCallingService();

            client.GetBasicInfo();
            UserEmailLabel.Text = client.UserProfile.Email;//n !!!!
            if (System.IO.File.Exists("phone_sound.wav"))
            {
                player = new SoundPlayer("phone_sound.wav");
            }

            CustomUserControl.Content = friendsListGrid;
            lastClickedTab            = FriendsButton;
        }
 private void UdpListenerButton_Click(object sender, RoutedEventArgs e)
 {
     if (!isListening)
     {
         StartListening(new IPEndPoint(CallingService.GetLocalIPAddress(), port));
     }
     else
     {
         isListening = false;
     }
 }
        public ClientSettingsUserControl(Client client, CallingService callingService, Window parentWindow)
        {
            this.client         = client;
            this.parentWindow   = parentWindow;
            this.callingService = callingService;

            InitializeComponent();
            PopulateInputDevicesCombo();
            //(parentWindow as ClientMainWindow).UserEmailLabel.Text = client.UserProfile.Email;//to robi fajny blad aplikacji przydatny do zrobienia poprawnego wylogowania usera po craschu apki
            EmailTextBox.Text = client.UserProfile.Email;
        }
 public FriendsList(Client client, CallingService callingService)
 {
     this.client         = client;
     this.callingService = callingService;
     InitializeComponent();
 }
 private void TurnOnUdpListening()
 {
     StartListening(new IPEndPoint(CallingService.GetLocalIPAddress(), port));
 }