Esempio n. 1
0
        public Chat(string[] MyUser, IVolupiaService server)
        {
            InitializeComponent();

            Server     = server;
            myUserName = MyUser[2];

            #region Instanciando Icone Notificação
            notifyIcon = new NotifyIcon()
            {
                BalloonTipTitle = "Volupia Messenger",
                Icon            = new Icon(Environment.CurrentDirectory + @"\VolupiaChat.ico"),
                Text            = ""
            };
            notifyIcon.MouseDoubleClick  += NotifyIcon_MouseDoubleClick;
            notifyIcon.BalloonTipClicked += NotifyIcon_BalloonTipClicked;
            #endregion

            timer2 = new Timer()
            {
                Interval = 1000
            };
            timer2.Tick += Timer2_Tick;

            LoadUserList(Server.GetCurrentUsers());
        }
Esempio n. 2
0
 public static void CreateChannel()
 {
     _channelFactory = new DuplexChannelFactory <IVolupiaService>(new VolupiaClientCallBack(), "VolupiaServiceEndPoint");
     Server          = _channelFactory.CreateChannel();
     if (_channelFactory.State == CommunicationState.Opened || _channelFactory.State == CommunicationState.Created)
     {
         ServerConnectionState = VConnectionState.Connected;
     }
 }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     UserListT.TextChanged += UserListT_TextChanged;
     _channelFactory        = new DuplexChannelFactory <IVolupiaService>(new VolupiaWebCallBack(), "VolupiaServiceEndPoint");
     VServer       = _channelFactory.CreateChannel();
     DisplayTxtBox = new TextBox
     {
         Text = DisplayTxtBoxT.Text
     };
 }
Esempio n. 4
0
        private void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            string login = UserEntryTB.Text, password = PasswordTB.Password.ToString();

            try
            {
                _channelFactory = new DuplexChannelFactory <IVolupiaService>(new VolupiaWPFClientCallBack(), "VolupiaServiceEndPoint");
                Server          = _channelFactory.CreateChannel();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Volupia Messenger");
            }
            if (Server.ValidateUser(login, password))
            {
                var  MyUser     = Server.GetUser(login, password);
                Chat chatWindow = new Chat(MyUser, Server);
                try
                {
                    int returnvalue = Chat.Server.Login(MyUser[2]);
                    if (returnvalue == 1)
                    {
                        MessageBox.Show("Você já está logado!", "Erro!");
                    }
                    else
                    {
                        chatWindow.Show();
                        chatWindow.Activate();
                        ((MainWindow)Application.Current.MainWindow).Close();
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    MessageBox.Show("O servidor está offline no momento, tente novamente mais tarde.", "Volupia Messenger");
                }
                catch (System.ServiceModel.CommunicationObjectFaultedException)
                {
                    MessageBox.Show("O cliente não conseguiu se comunicar com o servidor", "Volupia Messenger");
                }
            }
            else
            {
                MessageBox.Show("Usuário não encontrado ou senha incorreta.", "Volupia Messenger");
                this.Focus();
            }
        }
Esempio n. 5
0
 private void _channelFactory_Faulted(object sender, EventArgs e)
 {
     Server = _channelFactory.CreateChannel();
 }