public void CloseUserDashboards() { if (privateDiscBoard == null && discDashboard == null) { return; } if (privateDiscBoard != null) { privateDiscBoard.Close(); privateDiscBoard = null; } if (discDashboard != null) { discDashboard.Close(); discDashboard = null; } if (htmlBackgroundWnd != null) { htmlBackgroundWnd.Close(); htmlBackgroundWnd = null; } MessageDlg.Show("Moderator is offline or selected session is not running. User dashboards have been closed", "Info", MessageBoxButton.OK, MessageBoxImage.Information); }
public void Generate(Discussion discussion, string PdfPathName) { this.discussion = discussion; this.PdfPathName = PdfPathName; document = new Document(); // we create a writer that listens to the document // and directs a PDF-stream to a file try { PdfWriter.GetInstance(document, new FileStream(PdfPathName, FileMode.Create)); } catch (Exception e) { MessageDlg.Show("File I/O error " + e.Message); return; } document.Open(); Assemble(); document.Close(); Process.Start(PdfPathName); }
private void Run(Discussion A, Discussion B) { if (A == null || B == null) { return; } Tuple <int, int, string> range = GetRange(); if (range.Item3 != "") { return; } var ctx = PublicBoardCtx.Get(); var moderator = ctx.Person.FirstOrDefault(p => p.Name == "moderator"); if (moderator == null) { MessageDlg.Show("Cannot find moderator in DB"); return; } for (int i = range.Item1; i <= range.Item2; i++) { var disc = cloneDiscussion(ctx, A, moderator, i); DaoUtils.SetGeneralSide(moderator, disc, (int)SideCode.Neutral); ctx.AddToDiscussion(disc); var disc2 = cloneDiscussion(ctx, B, moderator, i); DaoUtils.SetGeneralSide(moderator, disc2, (int)SideCode.Neutral); ctx.AddToDiscussion(disc2); } ctx.SaveChanges(); MessageDlg.Show("Done"); }
public static void startHtml5TopicReport(int topicId) { if (SessionInfo.Get().discussion == null) { MessageDlg.Show("No default discussion"); return; } if (SessionInfo.Get().person.Session == null) { MessageDlg.Show( string.Format( "The function requires experimental mode (session)!", SessionInfo.Get().person.Name)); return; } var reportUrl = string.Format( "http://{0}/discsvc/report?discussionId={1}&topicId={2}&sessionId={3}", ConfigManager.ServiceServer, SessionInfo.Get().discussion.Id, topicId, SessionInfo.Get().person.Session.Id); try { System.Diagnostics.Process.Start("chrome", reportUrl); } catch { System.Diagnostics.Process.Start(reportUrl); } //var browser = WebkitBrowserWindow.Instance(reportUrl, topicId); //browser.Show(); //browser.Activate(); }
public static object RunViewer(Attachment a, bool localRequest) { if (a == null) { return(null); } if (a.Format == (int)AttachmentFormat.Pdf && a.MediaData != null) { string pdfPathName = Utils.RandomFilePath(".pdf"); try { using (var fs = new FileStream(pdfPathName, FileMode.Create)) { fs.Write(a.MediaData.Data, 0, a.MediaData.Data.Length); } //Process.Start(pdfPathName); Utils.ReportMediaOpened(StEvent.PdfOpened, a); var pdfReader = ReaderWindow2.Instance(pdfPathName, a.Id, a.ArgPoint != null ? (int?)a.ArgPoint.Topic.Id : null, localRequest); pdfReader.Show(); return(pdfReader); } catch { } } else if (MiniAttachmentManager.IsGraphicFormat(a)) { if (a.Format == (int)AttachmentFormat.PngScreenshot) { Utils.ReportMediaOpened(StEvent.ScreenshotOpened, a); } else { Utils.ReportMediaOpened(StEvent.ImageOpened, a); } if (a.MediaData.Data != null) { if (!ExplanationModeMediator.Inst.ImageViewerOpen) { var wnd = ImageWindow.Instance(a.Id, a.ArgPoint != null ? a.ArgPoint.Topic.Id : -1, localRequest); wnd.img.Source = LoadImageFromBlob(a.MediaData.Data); wnd.Show(); wnd.Activate(); return(wnd); } } } else { //office file var ext = Path.GetExtension(a.Link).ToLower(); string pathName = Utils.RandomFilePath(ext); try { using (var fs = new FileStream(pathName, FileMode.Create)) { fs.Write(a.MediaData.Data, 0, a.MediaData.Data.Length); } Process.Start(pathName); } catch (Exception e) { MessageDlg.Show(e.ToString(), "Error"); } } return(null); }
private static ImageSource ProcessCommand2(ArgPoint Point, AttachCmd cmd, string Url, ref Attachment a) { a = null; try { switch (cmd) { case AttachCmd.ATTACH_IMG_OR_PDF: a = AttachmentManager.AttachLocalFile(Point); if (a != null) { return(GetAttachmentBitmap3(a)); } break; case AttachCmd.ATTACH_PDF: a = AttachmentManager.AttachPDF(Point); if (a != null) { return(GetAttachmentBitmap3(a)); } break; case AttachCmd.ATTACH_PDF_FROM_URL: a = AttachmentManager.AttachPdfFromURL(Point, Url); if (a != null) { return(GetAttachmentBitmap3(a)); } break; case AttachCmd.ATTACH_IMAGE: a = AttachmentManager.AttachPicture(Point); if (a != null) { return(GetAttachmentBitmap3(a)); } break; case AttachCmd.ATTACH_IMAGE_URL: a = AttachmentManager.AttachFromURL(Point, Url); if (a != null) { return(GetAttachmentBitmap3(a)); } break; case AttachCmd.ATTACH_YOUTUBE: a = AttachmentManager.AttachFromYoutube(Point, Url); if (a != null) { return(new BitmapImage()); //returning stub for external error-checking } break; } } catch (Exception) { MessageDlg.Show( "Cannot process attachment. If it's link, check it's correct. If it's file, ensure program has permissions to access it", "Error"); return(null); } return(null); }
private static void MsgParticipantsShouldSelectDiscussion() { MessageDlg.Show("Participants should choose a discussion they are invited to"); }
//private static void MsgNameRegistered() //{ // MessageBox.Show("This name is already registered in this session", "Error", // MessageBoxButton.OK, MessageBoxImage.Error); //} private static void MsgPlaceReserved() { MessageDlg.Show("Some online user has taken selected seat in current session", "Error", MessageBoxButton.OK, MessageBoxImage.Error); }
public static void startResultViewer() { if (SessionInfo.Get().discussion == null) { MessageDlg.Show("No default discussion"); } else { if (SessionInfo.Get().person.Session == null) { MessageDlg.Show( string.Format( "The function requires experimental mode (session)!", SessionInfo.Get().person.Name)); return; } var tsd = new TopicSelectionDlg(SessionInfo.Get().discussion); tsd.ShowDialog(); if (tsd.topic == null) { return; } if (tsd.Html) { var reportUrl = string.Format( "http://{0}/discsvc/report?discussionId={1}&topicId={2}&sessionId={3}", ConfigManager.ServiceServer, SessionInfo.Get().discussion.Id, tsd.topic.Id, SessionInfo.Get().person.Session.Id); try { System.Diagnostics.Process.Start("chrome", reportUrl); } catch { System.Diagnostics.Process.Start(reportUrl); } //var browser = WebkitBrowserWindow.Instance(reportUrl, tsd.topic.Id); //browser.Show(); //browser.Activate(); } else { BusyWndSingleton.Show("Exporting, please wait..."); try { (new PdfReportDriver()).Run(SessionInfo.Get().person.Session, tsd.topic, SessionInfo.Get().discussion, SessionInfo.Get().person); } finally { BusyWndSingleton.Hide(); } } } }