private void createMeetingCallback(MeetingOutput output)
        {
            this.Dispatcher.BeginInvoke(delegate()
            {
                if (output.status == "ok")
                {
                    Meeting meeting         = new Meeting();
                    meeting.server          = server;
                    meeting.serverMeetingID = Convert.ToInt32(output.meetingid);
                    meeting.title           = output.title;
                    meeting.topic           = output.topic;
                    meeting.adminName       = output.hostname;
                    meeting.startTime       = output.starttime;
                    meeting.numerOfMembers  = 1;
                    meeting.permissions     = 2;
                    meeting.code            = output.accessCode;
                    MDEDB.Meetings.InsertOnSubmit(meeting);
                    MDEDB.SubmitChanges();

                    MessageBox.Show("Meeting created");

                    NavigationService.RemoveBackEntry();
                    NavigationService.Navigate(new Uri("/Pages/MeetingPage.xaml?meetingID=" + meeting.ID + "&removePrevious=" + bool.TrueString, UriKind.Relative));
                }
                else
                {
                    MessageBox.Show("Unable to join meeting.\nServer response:\n" + output.reason);

                    setControlEnabled(true);
                }
            });
        }
        private void editCallback(EditOutput output)
        {
            this.Dispatcher.BeginInvoke(delegate()
            {
                buttonProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                button.IsEnabled             = true;
                if (output == null)
                {
                    MessageBox.Show("Couldn't connect to server");
                }
                else if (output.status == "ok")
                {
                    var servers = new ObservableCollection <Server>(from Server s in MDEDB.Servers where s.serverName == server.serverName select s);
                    server.name = nameBox.Text;
                    server.pass = newPasswordBox.Password;
                    MDEDB.SubmitChanges();

                    MessageBox.Show("Logged in on server.");
                    NavigationService.GoBack();
                }
                else
                {
                    MessageBox.Show(output.reason);
                }
            });
        }
 private void connectCallback(ServerName result)
 {
     this.Dispatcher.BeginInvoke(delegate()
     {
         serverAddressBox.IsEnabled    = true;
         connectButton.IsEnabled       = true;
         connectProgressBar.Visibility = System.Windows.Visibility.Collapsed;
         if (result == null)
         {
             connectedPanel.Visibility = System.Windows.Visibility.Collapsed;
             MessageBox.Show("Couldn't connect to server");
         }
         else if (result.servername == null)
         {
             connectedPanel.Visibility = System.Windows.Visibility.Collapsed;
             MessageBox.Show("Incorrect server response, please contact with administrator or try again later.");
         }
         else
         {
             serverNameBox.Text = result.servername;
             var servers        = new ObservableCollection <Server>(from Server s in MDEDB.Servers where s.serverName == serverNameBox.Text select s);
             if (servers.Count() > 0)
             {
                 Server server = servers[0];
                 if (server.address == serverAddressBox.Text)
                 {
                     MessageBox.Show("You already have account on this server. \n If you want to change to another one, please remove server from application. " +
                                     "All data on the device will be lost. Data on the server will remain unchanged.");
                 }
                 else
                 {
                     server.address = serverAddressBox.Text;
                     MDEDB.SubmitChanges();
                     MessageBox.Show("You already have account on this server, under other address. Address in application had been automatically changed. \n If you want to change to another account, please remove server from application. " +
                                     "All data on the device will be lost. Data on the server will remain unchanged.");
                 }
                 connectedPanel.Visibility = System.Windows.Visibility.Collapsed;
             }
             else
             {
                 connectedPanel.Visibility = System.Windows.Visibility.Visible;
             }
         }
     });
 }
        private void loginCallback(LoginOutput output)
        {
            this.Dispatcher.BeginInvoke(delegate()
            {
                if (output.status == "ok")
                {
                    server.sid = output.sid;
                    MDEDB.SubmitChanges();

                    MessageBox.Show("Logged in on server.");
                    joinMeeting();
                }
                else
                {
                    MessageBox.Show("Login or password incorrect.");
                }
            });
        }
Esempio n. 5
0
 private void meetingListCallback(MeetingsListOutput output)
 {
     this.Dispatcher.BeginInvoke(delegate()
     {
         if (output == null)
         {
             //MessageBox.Show("Error communicating with server. Check your internet connection and try again.");
             connectionFailureTextBlock.Visibility = System.Windows.Visibility.Visible;
         }
         else if (output.status == "ok")
         {
             connectionFailureTextBlock.Visibility = System.Windows.Visibility.Collapsed;
             foreach (MeetingOutput meetingOutput in output.meetings)
             {
                 var meeting = (from Meeting m in MDEDB.Meetings where m.serverMeetingID == meetingOutput.meetingid select m);
                 if (meeting.Count() == 0)
                 {
                     MDEDB.Meetings.InsertOnSubmit(meetingOutput.getEntity(server));
                 }
                 else
                 {
                     Meeting m1        = meeting.ToList()[0];
                     Meeting m2        = meetingOutput.getEntity(server);
                     m1.adminName      = m2.adminName;
                     m1.topic          = m2.topic;
                     m1.title          = m1.title;
                     m1.numerOfMembers = m2.numerOfMembers;
                     m1.permissions    = m2.permissions;
                     m1.startTime      = m2.startTime;
                     m1.endTime        = m2.endTime;
                 }
             }
             MDEDB.SubmitChanges();
             meetings = new ObservableCollection <Meeting>(from Meeting m in MDEDB.Meetings
                                                           where m.server == server
                                                           select m);
         }
         else
         {
             MessageBox.Show("Unable to refresh.\nServer response:\n" + output.reason);
         }
         setControlEnabled(true);
     });
 }
 private void filesListCallback(FilesListOutput output)
 {
     this.Dispatcher.BeginInvoke(delegate()
     {
         if (output == null)
         {
             //MessageBox.Show("Error communicating with server. Check your internet connection and try again.");
             connectionFailureTextBlock.Visibility = System.Windows.Visibility.Visible;
         }
         else if (output.status == "ok")
         {
             connectionFailureTextBlock.Visibility = System.Windows.Visibility.Collapsed;
             foreach (FileOutput fileOutput in output.files)
             {
                 var file = (from File f in MDEDB.Files where f.serverFileID == fileOutput.fileid select f);
                 if (file.Count() == 0)
                 {
                     MDEDB.Files.InsertOnSubmit(fileOutput.getEntity(meeting));
                 }
                 else
                 {
                     File f1       = file.ToList()[0];
                     File f2       = fileOutput.getEntity(meeting);
                     f1.addTime    = f2.addTime;
                     f1.authorName = f2.authorName;
                     f1.comments   = f2.comments;
                     f1.fileName   = f2.fileName;
                 }
             }
             MDEDB.SubmitChanges();
             files = new ObservableCollection <File>(from File f in MDEDB.Files
                                                     where f.meeting == meeting
                                                     select f);
         }
         else
         {
             MessageBox.Show("Unable to refresh.\nServer response:\n" + output.reason);
         }
         setControlEnabled(true);
     });
 }