public static Attachment GetFirstAttachment(ArgPoint pt) { if (pt != null && pt.Attachment.Count > 0) return pt.Attachment.First(); else return null; }
public ClusterReport(Topic topic, int clusterId, int clusterShId, string clusterTitle, ArgPoint[] points, Person initialOwner) { this.topic = topic; this.clusterId = clusterId; this.clusterTitle = clusterTitle; this.points = points; this.initialOwner = initialOwner; this.clusterShId = clusterShId; }
public static async Task OpenAttachmentAsync(ArgPoint ap, Random rnd) { if (!ap.Attachment.Any()) return; var attachment = ap.Attachment.ElementAt(rnd.Next(ap.Attachment.Count)); SyncMsgType syncMsgType; switch ((AttachmentFormat)attachment.Format) { case AttachmentFormat.None: throw new NotImplementedException(); break; case AttachmentFormat.Jpg: syncMsgType = SyncMsgType.ImageView; break; case AttachmentFormat.Png: syncMsgType = SyncMsgType.ImageView; break; case AttachmentFormat.Bmp: syncMsgType = SyncMsgType.ImageView; break; case AttachmentFormat.Pdf: syncMsgType = SyncMsgType.PdfView; break; case AttachmentFormat.Youtube: syncMsgType = SyncMsgType.YoutubeView; break; case AttachmentFormat.GeneralWebLink: syncMsgType = SyncMsgType.SourceView; break; case AttachmentFormat.PngScreenshot: syncMsgType = SyncMsgType.ImageView; break; case AttachmentFormat.WordDocSet: throw new NotImplementedException(); break; case AttachmentFormat.ExcelDocSet: throw new NotImplementedException(); break; case AttachmentFormat.PowerPointDocSet: throw new NotImplementedException(); break; default: throw new ArgumentOutOfRangeException(); } UISharedRTClient.Instance.clienRt.SendExplanationModeSyncRequest( syncMsgType, attachment.Id, true); await Utils.DelayAsync(1500+rnd.Next(1000)); UISharedRTClient.Instance.clienRt.SendExplanationModeSyncRequest( syncMsgType, attachment.Id, false); }
private void _commentReader_Tick(object sender, EventArgs e) { StopTimer(); //if point is new and has not been saved if (_recentPoint == null || _recentPoint.Topic == null) return; _onDismiss(_recentPoint); _recentPoint = null;//only single notification per arg.point during reading corridor }
void Init(ArgPoint ap) { Id = ap.Id; Point = ap.Point; SideCode = ap.SideCode; SharedToPublic = ap.SharedToPublic; RecentlyEnteredSource = ap.RecentlyEnteredSource; RecentlyEnteredMediaUrl = ap.RecentlyEnteredMediaUrl; OrderNumber = ap.OrderNumber; PersonId = ap.Person.Id; Description = ap.Description.Text; }
private void AttachFile(ArgPoint ap, string command) { if (_d == null) return; Attachment a = new Attachment(); if (AttachmentManager.ProcessAttachCmd(null, AttachCmd.ATTACH_IMG_OR_PDF, ref a) != null) { a.Discussion = _d; a.Person = getFreshPerson(); insertMedia(a); } }
public ZoomWindow(ArgPoint ap) { InitializeComponent(); // Add handlers for window availability events AddWindowAvailabilityHandlers(); largeBadgeView.DataContext = ap; largeBadgeView.SetRt(UISharedRTClient.Instance); UISharedRTClient.Instance.clienRt.SendStatsEvent(StEvent.BadgeZoomIn, SessionInfo.Get().person.Id, SessionInfo.Get().discussion.Id, ap.Topic.Id, DeviceType.Wpf); }
void OnDismiss(ArgPoint ap) { //Console.Beep(); CommentDismissalRecognizer.pushDismissal(ap, PrivateCenterCtx.Get()); }
void ArgPointNode(ArgPoint ap, bool insertScreenshot) { if(ap==null) return; ProcessedArgPoints.Add(ap.Id); if(ap.Person==null) return; #line default #line hidden #line 281 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\t\t<tr>\r\n\t\t\t<td style=\"padding:25px 0; border:0px; border-left:solid 20px; border-" + "left-color:"); #line default #line hidden #line 283 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Helpers.IntToHtml(ap.Person.Color))); #line default #line hidden #line 283 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\">\r\n\t\t\t\t<div class=\"boldCaption\">"); #line default #line hidden #line 284 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture((new DiscLink{Id=ap.Id, LinkObject=LinkObject.ArgPoint, EmitType=EmitType.Anchor}).Emit("Point#" + ap.OrderNumber + ". " + ap.Point))); #line default #line hidden #line 284 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("</div> \r\n\t\t\t\t\r\n\t\t\t\t"); #line default #line hidden #line 286 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" if(insertScreenshot) { #line default #line hidden #line 289 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\t\t\t\t <div style=\"text-align: center; padding-top:40px\">\r\n\t\t\t\t <img src="); #line default #line hidden #line 291 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Screenshots[-ap.Id-1].url)); #line default #line hidden #line 291 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(" > \t\t\r\n\t\t\t </div>\r\n\t\t\t\t "); #line default #line hidden #line 293 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" } #line default #line hidden #line 295 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\r\n\t\t\t\t<p>\r\n\t\t\t\t"); #line default #line hidden #line 298 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Helpers.processLineBreaks(ap.Description.Text))); #line default #line hidden #line 298 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(" \r\n\t\t\t\t</p>\r\n\t\r\n\t\t\t\t<!-- media -->\r\n\t\t\t\t<div class=\"boldCaption\">Media</div> \r\n\t\t" + "\t\t"); #line default #line hidden #line 303 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" EmitMediaTable(ap.Attachment); #line default #line hidden #line 305 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\t\t\t\r\n\t\t\t\t<div class=\"boldCaption\">Sources</div> \r\n\t\t\t\t<div style=\"text-align: lef" + "t; padding-left:40px\">\r\n\t\t\t\t\t"); #line default #line hidden #line 309 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" var i = 1; foreach(var src in ap.Description.Source.OrderBy(s=>s.OrderNumber)) { #line default #line hidden #line 311 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\t\t\t\t\t\t "); #line default #line hidden #line 312 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture(i++)); #line default #line hidden #line 312 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(". <a href=\""); #line default #line hidden #line 312 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture(src.Text)); #line default #line hidden #line 312 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\">"); #line default #line hidden #line 312 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write(this.ToStringHelper.ToStringWithCulture(src.Text)); #line default #line hidden #line 312 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("<a><br>\t\t\t\t\t \r\n\t\t\t\t\t\t"); #line default #line hidden #line 313 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" } #line default #line hidden #line 313 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\t\t\t\t</div>\r\n\r\n\t\t\t\t<!-- comments -->\r\n\t\t\t\t<div class=\"boldCaption\">Comments</div> " + "\r\n\t\t\t\t<table>\r\n\t\t\t\t"); #line default #line hidden #line 319 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" foreach(var c in ap.Comment) { if(c.Person==null) continue; EmitCommentOrArgPointLine(c.Person, c.Text, new DiscLink{Id=c.Id, LinkObject=LinkObject.Comment, EmitType=EmitType.Anchor}); } #line default #line hidden #line 325 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" this.Write("\t\t\t\t</table>\r\n\t\t\t</td>\r\n\t </tr>\r\n\t\t"); #line default #line hidden #line 329 "C:\Users\User\Documents\Visual Studio 2013\Projects\TDS4\discussions\DiscSvc2\Reporting\Report.tt" }
/// <summary> /// Deprecated Method for adding a new object to the ArgPoint EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToArgPoint(ArgPoint argPoint) { base.AddObject("ArgPoint", argPoint); }
public EditBadgeEventArgs(RoutedEvent routedEvent, ArgPoint ap, EditableBadge control) : base(routedEvent) { ArgPt = ap; BadgeControl = control; }
public static Attachment AttachCloudEntry(ArgPoint Point, StorageSelectionEntry selEntry) { var a = new Attachment {Name = selEntry.Title}; try { a.Format = (int) GetImgFmt(selEntry.Title); //may throw exception in case of unsupported file format } catch (Exception) { throw new IncorrectAttachmentFormat(); } a.MediaData = DaoUtils.CreateMediaData(AnyFileToBytes(selEntry.PathName)); a.Title = "";// selEntry.Title; a.Link = selEntry.Title; if (a.Format == (int) AttachmentFormat.Pdf) a.Thumb = TryCreatePdfThumb(selEntry.PathName); if (Point != null) a.ArgPoint = Point; return a; }
//asks for URL public static ImageSource ProcessAttachCmd(ArgPoint Point, AttachCmd cmd, ref Attachment a) { return ProcessCommand2(Point, cmd, null, ref a); }
//uses provided URL public static ImageSource ProcessAttachCmd(ArgPoint Point, string Url, ref Attachment a) { var cmd = DeriveCmdFromUrl(Url); return ProcessCommand2(Point, cmd, Url, ref a); }
/// <summary> /// If for example topic changes, or arg.point changes, we reset any possible existing timing /// </summary> public void Reset(ArgPoint ap) { StopTimer(); _recentPoint = ap; }
private static Attachment AttachAsBlob(string filter, AttachmentFormat format, bool autoInferenceOfFormat, ArgPoint Point) { var openFileDialog1 = new OpenFileDialog {Filter = filter, RestoreDirectory = true}; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string attachmentName = Path.GetFileName(openFileDialog1.FileName); var a = new Attachment {Name = attachmentName, Title = attachmentName, Link = openFileDialog1.FileName}; if (autoInferenceOfFormat) format = GetImgFmt(openFileDialog1.FileName); switch (format) { case AttachmentFormat.Pdf: a.MediaData = DaoUtils.CreateMediaData(AnyFileToBytes(openFileDialog1.FileName)); a.Thumb = TryCreatePdfThumb(openFileDialog1.FileName); break; case AttachmentFormat.Jpg: a.MediaData = DaoUtils.CreateMediaData(ImgFileToBytes(openFileDialog1.FileName)); break; case AttachmentFormat.Png: a.MediaData = DaoUtils.CreateMediaData(ImgFileToBytes(openFileDialog1.FileName)); break; case AttachmentFormat.Bmp: a.MediaData = DaoUtils.CreateMediaData(ImgFileToBytes(openFileDialog1.FileName)); break; case AttachmentFormat.ExcelDocSet: a.MediaData = DaoUtils.CreateMediaData(AnyFileToBytes(openFileDialog1.FileName)); break; case AttachmentFormat.WordDocSet: a.MediaData = DaoUtils.CreateMediaData(AnyFileToBytes(openFileDialog1.FileName)); break; case AttachmentFormat.PowerPointDocSet: a.MediaData = DaoUtils.CreateMediaData(AnyFileToBytes(openFileDialog1.FileName)); break; } a.Format = (int) format; a.Name = attachmentName; if (Point != null) Point.Attachment.Add(a); return a; } return null; }
public static Attachment AttachScreenshot(ArgPoint Point, Bitmap screenshot) { var screenPath = Utils.RandomFilePath(".png"); screenshot.Save(screenPath, ImageFormat.Png); var a = new Attachment(); a.Name = screenPath; a.Format = (int) AttachmentFormat.PngScreenshot; a.MediaData = DaoUtils.CreateMediaData(ImgFileToBytes(screenPath)); a.Title = "Screenshot, " + Environment.MachineName + " " + DateTime.Now; a.Link = a.Title; if (Point != null) a.ArgPoint = Point; return a; }
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; }
public static string ArgPointToStr(ArgPoint ap) { return string.Format("Point#{0}. {1}", ap.OrderNumber, ap.Point); }
public static Attachment AttachPicture(ArgPoint Point) { return AttachAsBlob("Graphics |*.jpg;*.jpeg;*.bmp;*.png", AttachmentFormat.None, true, Point); }
private TreeViewItem GetPointReport(ArgPoint ap) { var txt = new TextBlock(); if (ap.Description.Text != "Description") txt.Text += ap.Description.Text; else txt.Text += "No description"; var res = new TreeViewItem(); res.Header = GetHeader(ap.Person, " - " + ap.Point); res.Items.Add(txt); return res; }
public static Attachment AttachPDF(ArgPoint Point) { return AttachAsBlob("PDF |*.pdf", AttachmentFormat.Pdf, true, Point); }
/// <summary> /// Create a new ArgPoint object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="point">Initial value of the Point property.</param> /// <param name="sideCode">Initial value of the SideCode property.</param> /// <param name="sharedToPublic">Initial value of the SharedToPublic property.</param> /// <param name="recentlyEnteredSource">Initial value of the RecentlyEnteredSource property.</param> /// <param name="recentlyEnteredMediaUrl">Initial value of the RecentlyEnteredMediaUrl property.</param> /// <param name="changesPending">Initial value of the ChangesPending property.</param> /// <param name="orderNumber">Initial value of the OrderNumber property.</param> public static ArgPoint CreateArgPoint(global::System.Int32 id, global::System.String point, global::System.Int32 sideCode, global::System.Boolean sharedToPublic, global::System.String recentlyEnteredSource, global::System.String recentlyEnteredMediaUrl, global::System.Boolean changesPending, global::System.Int32 orderNumber) { ArgPoint argPoint = new ArgPoint(); argPoint.Id = id; argPoint.Point = point; argPoint.SideCode = sideCode; argPoint.SharedToPublic = sharedToPublic; argPoint.RecentlyEnteredSource = recentlyEnteredSource; argPoint.RecentlyEnteredMediaUrl = recentlyEnteredMediaUrl; argPoint.ChangesPending = changesPending; argPoint.OrderNumber = orderNumber; return argPoint; }
public static Attachment AttachLocalFile(ArgPoint Point) { var filterSb = new StringBuilder(); filterSb.Append("Local file|"); filterSb.Append("*.jpg;*.jpeg;*.bmp;*.png;"); filterSb.Append("*.docx;*.docm;*.dotx;*.dotm;*.doc;*.rtf;*.odt;"); filterSb.Append("*.xlsx;*.xlsm;*.xlsb;*.xltx;*.xltm;*.xls;*.xlt"); filterSb.Append("*.pptx;*.ppt;*.pptm;*.ppsx;*.pps;*.potx;*.pot*;*.potm;*.odp"); return AttachAsBlob(filterSb.ToString(), AttachmentFormat.None, true, Point); }
public static ArgPoint NewArgPoint(string Point) { ArgPoint res = new ArgPoint(); res.Point = Point; return res; }
//if URL==null, shows URL input dialog. else uses provided URL, no dialog private static Attachment AttachFromURL(ArgPoint Point, string Url) { string UrlToUse = Url; if (UrlToUse == null) { InpDialog dlg = new InpDialog(); dlg.ShowDialog(); UrlToUse = dlg.Answer; if (UrlToUse == null || !UrlToUse.StartsWith("http://")) return null; } string tmpFile = DownloadImageFromURL(UrlToUse); if (tmpFile == null) return null; Attachment res = new Attachment(); res.Name = UrlToUse; res.Format = (int) AttachmentFormat.Jpg; //all downloads are jpg res.MediaData = DaoUtils.CreateMediaData(ImgFileToBytes(tmpFile)); res.Title = ""; res.Link = Url; if (Point != null) Point.Attachment.Add(res); //PublicBoardCtx.Get().SaveChanges(); return res; }
private void getPointAndTopic(out ArgPoint ap, out Topic t) { t = null; ap = null; t = lstTopics.SelectedItem as Topic; if (t == null) return; ap = theBadge.DataContext as ArgPoint; }
//if URL==null, shows URL input dialog. else uses provided URL, no dialog private static Attachment AttachPdfFromURL(ArgPoint Point, string Url) { string UrlToUse = Url; if (UrlToUse == null) { InpDialog dlg = new InpDialog(); dlg.ShowDialog(); UrlToUse = dlg.Answer; UrlToUse = UrlToUse.ToLower(); if (UrlToUse == null || !UrlToUse.StartsWith("http://") || UrlToUse.EndsWith(".pdf")) return null; } string tmpFile = DownloadPdfFromUrl(UrlToUse); if (tmpFile == null) return null; Attachment res = new Attachment(); res.Name = UrlToUse; res.Format = (int) AttachmentFormat.Pdf; res.MediaData = DaoUtils.CreateMediaData(AnyFileToBytes(tmpFile)); res.Title = ""; res.Thumb = TryCreatePdfThumb(tmpFile); res.Link = Url; if (Point != null) Point.Attachment.Add(res); ///PublicBoardCtx.Get().SaveChanges(); return res; }
//we can only process one deleted point at a time private void saveProcedure(ArgPoint deletedPt, int TopicOfDeletedPointId) { //extract modification lists List<ArgPoint> created = null; List<ArgPoint> edited = null; List<ArgPoint> deleted = null; GetChangeLists(out created, out edited, out deleted); Topic t; ArgPoint editedPoint; getPointAndTopic(out editedPoint, out t); //save changes PrivateCenterCtx.SaveChangesIgnoreConflicts(); //first notify about deleted point! if (deletedPt != null) _sharedClient.clienRt.SendArgPointDeleted(deletedPt.Id, TopicOfDeletedPointId, SessionInfo.Get().person.Id); //notify about changes foreach (var createdPt in created) _sharedClient.clienRt.SendArgPointCreated(createdPt.Id, createdPt.Topic.Id, SessionInfo.Get().person.Id); foreach (var editedPt in edited) _sharedClient.clienRt.SendArgPointChanged(editedPt.Id, editedPt.Topic.Id, SessionInfo.Get().person.Id); }
//if Url!=null, uses it. otherwice asks for URL private static Attachment AttachFromYoutube(ArgPoint Point, string Url) { string URLToUse = Url; if (URLToUse == null) { InpDialog dlg = new InpDialog(); dlg.ShowDialog(); URLToUse = dlg.Answer; if (URLToUse == null || !URLToUse.StartsWith("http://")) return null; } BusyWndSingleton.Show("Processing Youtube attachment..."); Attachment res = new Attachment(); try { YouTubeInfo videoInfo = YouTubeProvider.LoadVideo(URLToUse); if (videoInfo == null) return null; res.Format = (int) AttachmentFormat.Youtube; res.VideoEmbedURL = videoInfo.EmbedUrl; res.VideoThumbURL = videoInfo.ThumbNailUrl; res.VideoLinkURL = videoInfo.LinkUrl; res.Link = videoInfo.LinkUrl; res.Title = videoInfo.VideoTitle; res.Name = URLToUse; res.Thumb = ImageToBytes(GetYoutubeThumb(videoInfo.ThumbNailUrl), new JpegBitmapEncoder()); if (Point != null) Point.Attachment.Add(res); ///PublicBoardCtx.Get().SaveChanges(); } finally { BusyWndSingleton.Hide(); } return res; }