private bool UploadDocument() { try { // login to ftp server\ //strRemoteUrl="http://www.compassnav.com/"; //strRemoteUrl=Info.getInstance().WebsiteName +@"/"; //zaeem: Hard coded to run on Vista System //strRemoteUrl="http://216.117.130.240:5216"+@"/"; //strRemoteUrl="http://soerwa.hopto.org/Compassnav"+@"/"; strRemoteUrl="http://vista/Compassnav"+@"/"; //FtpClient ftp = new FtpClient(m_serverIP,m_username,m_password); //FtpClient ftp = new FtpClient("soerwa.hopto.org","zaeem","zaeem"); FtpClient ftp = new FtpClient("vista","Ahmed","three"); ftp.OnStatusUpdateFunction = new WebMeeting.FTP.FtpClient.OnStatusUpdate(FtpUploadStatus); try { if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction(LOGGING_MSG);//"Unable to upload files to WebServer. " + ee.Message); ftp.Login(); } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>341",exp,"Unable to Logon to server.",true); if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction("Unable to Logon to server."); return false; } try { ftp.ChangeDir("WebMeeting"); } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>355",exp,null,false); ftp.MakeDir("WebMeeting"); ftp.ChangeDir("WebMeeting"); } strRemoteUrl+="WebMeeting/"; try { ftp.ChangeDir("Uploads"); } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>367",exp,null,false); ftp.MakeDir("Uploads"); ftp.ChangeDir("Uploads"); } strRemoteUrl+="Uploads/"; try { ftp.MakeDir(m_meetingID);//.GetFileList(); strRemoteUrl+=(m_meetingID.ToString()+"/"); } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>379",exp,null,false); // it already exists } if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction(LOGGED_ON_MSG);//"Unable to upload files to WebServer. " + ee.Message); ftp.ChangeDir(m_meetingID); try { ftp.MakeDir(sessionID.ToString());//.GetFileList(); strRemoteUrl+=sessionID.ToString()+"/"; } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>395",exp,null,false); // it already exists } OnStatusUpdateFunction(UPLOADING_MSG); ftp.ChangeDir(sessionID.ToString()); string documentFolderName = ""; try { if(this.m_DocumentType == DocumentMessageType.typeDocument) documentFolderName = "Documents"; else if(this.m_DocumentType == DocumentMessageType.typeExcel) documentFolderName = "WorkBooks"; else if(this.m_DocumentType == DocumentMessageType.typePDF) documentFolderName = "PDF"; else if(this.m_DocumentType == DocumentMessageType.typePresentation) documentFolderName = "Presentations"; ftp.MakeDir(documentFolderName); strRemoteUrl+=documentFolderName; } catch(Exception exp ) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>419",exp,null,false); } ftp.ChangeDir(documentFolderName); try { if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction(COMPRESSING_MSG + Path.GetFileName(m_sharedFilePath));//"Unable to upload files to WebServer. " + ee.Message); string localFile = ""; string fileWithoutExt = ""; if(m_sharedFilePath.IndexOf("Downloaded", 0, m_sharedFilePath.Length)!=-1) { localFile = m_sharedFilePath; } else { fileWithoutExt = Path.GetFileNameWithoutExtension(m_sharedFilePath); /* if(fileWithoutExt.IndexOf(".") > 0) { MessageBox.Show("==>file with Dot"); fileWithoutExt = Path.GetFileNameWithoutExtension(fileWithoutExt ); localFile = Application.StartupPath + "\\DocumentSharing\\Uploaded\\" + documentFolderName + "\\" + fileWithoutExt ; CreateLocalDirectoryStructure(true); if(Directory.Exists(localFile)) Directory.Delete(localFile,true); Directory.CreateDirectory(localFile); localFile += "\\" + Path.GetFileName(m_sharedFilePath) ; } else */ //{ // MessageBox.Show("==>file with NOOOOO Dot"); localFile = Application.StartupPath + "\\DocumentSharing\\Uploaded\\" + documentFolderName + "\\" + fileWithoutExt ; CreateLocalDirectoryStructure(true); if(Directory.Exists(localFile)) Directory.Delete(localFile,true); Directory.CreateDirectory(localFile); localFile += "\\" + Path.GetFileName(m_sharedFilePath) + ".zip"; //} } try { ICSharpZip.ZipFile(m_sharedFilePath, localFile); if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction(UPLOADING_MSG + Path.GetFileName(m_sharedFilePath));//"Unable to upload files to WebServer. " + ee.Message); } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>474",exp,exp.Message.ToString(),true); } ftp.Upload(localFile); //ftp.Upload(this.m_sharedFilePath); //ftp.UploadDirectory(destFile,true); ftp.Close(); // theFile=new FileInfo(localFile); // theFile.Delete(); return true; } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>490",exp,"Unable to upload files to WebServer. " + exp.Message.ToString(),true); if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction("Unable to upload files to WebServer. " + exp.Message); //ftp.Close(); //MessageBox.Show("Couldnt upload " + ee.ToString()); //Zaeem//return false; return true; } } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage( "DocumentSharingEx.cs ==>UploadDocument() line==>490",exp,"Unable to upload files to WebServer. " + exp.Message.ToString(),true); if(OnStatusUpdateFunction !=null) OnStatusUpdateFunction("Unable to upload files to WebServer. " + exp.Message); // MessageBox.Show("Couldnt upload " + ee.ToString()); } //return false; return true;; }
public ClientUI() { InitializeComponent(); MM_Controller=new WebMeeting.Client.Minuts_Meeting.Minuts_Controller(); db=new WebMeeting.Client.ClientDataBase.DatabaseAccess("WebMeeting_Client.dll"); fcu=new FtpClient(ConfigurationSettings.AppSettings["FtpServer"].ToString(),ConfigurationSettings.AppSettings["FtpServer_Username"].ToString(),ConfigurationSettings.AppSettings["FtpServer_Password"].ToString(),2000,21); pb=new WebMeeting.Client.Minuts_Meeting.Progressbar(); try { //ff = new SaveFileDialog (); //this.Text = ; notesControl=new NotesControl(); #region set backcolor of tab controls this.BackColor=Info.getInstance().backColor; tabBody.BackColor=Info.getInstance().backColor; panelBody.BackColor=Info.getInstance().backColor; tabControl1.BackColor=Info.getInstance().ParticipantBackColor; tabControlWebContent.BackColor = Info.getInstance().backColor; pollingTabControl.BackColor = Info.getInstance().backColor; rightPanel.BackColor=Info.getInstance().backColor; chatTabControl.BackColor=Info.getInstance().backColor; panelQuickLaunch.BackColor = System.Drawing.Color.FromArgb(209,194,197); #endregion #region set height tabPageChat.Height=200; chatTabControl.Height=308; tabPageNotes.ImageIndex = 1; tabPageNotes.Height=200; tabBody.Height = splitter1.Height ; tabPageChat.ImageIndex = 0; #endregion #region set status bar _statusBar = new DotNetStatusBar(); _statusBar.BringToFront(); _statusBar.Parent = this; this._statusBar.Name = "statusBar1"; #endregion #region Set Menu. myNiceMenu = new NiceMenu(); //myNiceMenu.AddMenuImage = false; myNiceMenu.MenuImages = mainMenuImageList; myNiceMenu.UpdateMenu(this.mainMenu1, new NiceMenuClickEvent(mnuGestioneEventoClick)); #endregion #region get info and network instances info = Info.getInstance(); info.ConferenceID="1"; thisInstance = this; network= NetworkManager.getInstance(); network.ChildWindowCreationEvent +=new MakeChildWindow(network_ChildWindowCreationEvent); #endregion #region add Participants tabs tabPage1.Title = "Participants"; tabPage1.Control = listParticipents; tabControl1.TabPages.Add(tabPage1); tabControl1.TabPages.Add(tabPageFind); tabPageFind.Control=objFindParticipetsControl; #endregion #region set instances of netword and this(clientUI) network.pClient = this; #endregion #region set chat controls tabs tabPageChat.Title = "Chat"; tabPageNotes.Title="Notes"; chatControl1 = chatControl.getInstance(); tabPageChat.Control = chatControl1; chatControl1.thisWindowTabPage = tabPageChat; tabPageNotes.Control=this.notesControl; chatTabControl.TabPages.Add(tabPageChat); chatTabControl.TabPages.Add(tabPageNotes); chatTabControl.ClosePressed+=new System.EventHandler(this.Close_ChatPanel); #endregion #region white board settind tabPageInfo.Title = "WhiteBoard"; tabPageInfo.ImageList=this.imageList1; tabPageInfo.ImageIndex=4; whiteBoard = new WhiteboardControl(); //per2 tabPageInfo.Control = whiteBoard; //per2 tabPageInfo.Visible=false; //per2 this.whiteBoard.DrawingTool = WebMeetingDrawingBoard.WhiteboardToolCode.None; //per2 #endregion #region set visibility tabPageDesktopSharing.Visible = false; listParticipents.Visible = true; #endregion #region screen capturing tabPageScreenCapture.Control = screencaptureControl; screencaptureControl.ChangeState(true); #endregion #region listParticipents settings listParticipents.SmallImageList = listViewImageList; listParticipents.GridLines = false; #endregion #region set controls to tabpages // //TabPageQAAttendee.Control = qaAttendee; //TabPageQAPresenter.Control = qaPresenter; frmQAA.Controls.Add(qaAttendee); frmQAP.Controls.Add(qaPresenter); //tabPageWebContentPolls.Control = manageContentWebPolls; //tabPageWebContentBookmarks.Control = manageContentBookmarks; //tabPageWebFiles.Control = manageContentWebFiles; //tabPageWebEvaluation.Control = manageContentEvaluations; //tabPageWebPresentations.Control = manageContentPresentations; //tabPageWebInfo.Control = manageContentInformtaion; #endregion #region add tab pages in tabControlWebContent (Manage Content) and setting //tabControlWebContent.TabPages.Add(tabPageWebInfo); //tabControlWebContent.TabPages.Add(tabPageWebPresentations); //tabControlWebContent.TabPages.Add(tabPageWebContentPolls); //tabControlWebContent.TabPages.Add(tabPageWebContentBookmarks); //tabControlWebContent.TabPages.Add(tabPageWebFiles); //tabControlWebContent.TabPages.Add(tabPageWebEvaluation); tabPageWebContent.Title = "Manage Content"; tabBody.OnSelectionChangingEx +=new WebMeeting.Client.TabControlEx.DelegateSelectionChanged(tabBody_OnSelectionChangingEx); splitter1.SplitterThumbBackColoor = Color.DarkBlue; tabPageWebContent.Control = manageContentPresentations; whiteBoard.pictureBox1.SizeMode = PictureBoxSizeMode.Normal; //per2 SynchWindowProc = new FnSynchWindow(SynchWindow); #endregion #region set tooltips for drawing tools ToolTip drawingToolTip = new ToolTip(); // Set up the delays for the ToolTip. drawingToolTip.AutoPopDelay = 1000; drawingToolTip.InitialDelay = 1000; drawingToolTip.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. drawingToolTip.ShowAlways = true; drawingToolTip.SetToolTip(this.btnCircle, "Elipse"); drawingToolTip.SetToolTip(this.btnArrow, "UnSelect"); drawingToolTip.SetToolTip(this.btnBrush, "Brush"); drawingToolTip.SetToolTip(this.btnClearWhiteBoard, "Clear All"); drawingToolTip.SetToolTip(this.btnEraser, "Eraser"); drawingToolTip.SetToolTip(this.btnFont, "Font"); drawingToolTip.SetToolTip(this.btnLine, "Line"); drawingToolTip.SetToolTip(this.btnNone, "Pointing Tool"); drawingToolTip.SetToolTip(this.btnPencil, "Pencil"); drawingToolTip.SetToolTip(this.btnPlaceHolderArrow, "Place Holder Arrow"); drawingToolTip.SetToolTip(this.btnRectangle, "Rectangle"); drawingToolTip.SetToolTip(this.btnText, "Text"); drawingToolTip.SetToolTip(this.btnColor,"Color Chooser"); drawingToolTip.SetToolTip(this.button4,"Line Thickness"); drawingToolTip.SetToolTip(this.splitter1,"Hide/Show Right Panels"); #endregion #region set listParticipents(Participents) coloumns width this.listParticipents.Columns[1].Width=42; //Color this.listParticipents.Columns[2].Width=17; //Speed this.listParticipents.Columns[3].Width=0; //Mood this.listParticipents.Columns[4].Width=45; this.listParticipents.Columns[5].Width=20; #endregion /* * get the configuration setting relevant to exception handling * * */ ReadConfigFiles(); ChangeResolution(true); } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ClientUI.cs line==> 750",exp,null,false); //ShowExceptionMessage("Constructor of Application GUI has encountered an exception. " + ee.Message); } }