StartReportingActivities(Topic topic, Discussion disc, Session session) { _topic = topic; _disc = disc; _session = session; var moder = DbCtx.Get().Person.Single(p => p.Name.StartsWith("moder")); _clienRt = new ClientRT(disc.Id, ConfigManager.ServiceServer, moder.Name, moder.Id, DeviceType.Wpf); _clienRt.onJoin += OnJoined; _hardReportTCS = new TaskCompletionSource<ReportCollector>(); _remoteScreenshotTCS = new TaskCompletionSource<Dictionary<int, byte[]>>(); Task.Factory.StartNew(async () => { while (_servicingPhotonClient) { _clienRt.Service(); await Utils.Delay(80); } }, TaskCreationOptions.LongRunning); return new Tuple<Task<Dictionary<int, byte[]>>, Task<ReportCollector>>( _remoteScreenshotTCS.Task, _hardReportTCS.Task); }
public ReportingActivitiesTasks StartReportingActivities(Topic topic, Discussion disc, Session session, DiscCtx ctx) { _topic = topic; _disc = disc; _session = session; var moder = ctx.Person.Single(p => p.Name.StartsWith("moder")); _clienRt = new ClientRT(disc.Id, ConfigManager.ServiceServer, moder.Name, moder.Id, DeviceType.Wpf); _clienRt.onJoin += OnJoined; _hardReportTCS = new TaskCompletionSource<ReportCollector>(); _remoteScreenshotTCS = new TaskCompletionSource<Dictionary<int, byte[]>>(); Task.Factory.StartNew(async () => { while (_servicingPhotonClient) { _clienRt.Service(); await Utils.Delay(40); } }); return new ReportingActivitiesTasks { ReportTask = _hardReportTCS.Task, ScreenshotsTask = _remoteScreenshotTCS.Task }; }
public PdfAssembler(Discussion discussion, Topic topic, Person person, string PdfPathName) { this._discussion = discussion; this._topic = topic; this._PdfPathName = PdfPathName; this._person = person; }
public SourceBot() { _topic = SessionInfo.Get().discussion.Topic.First(); _rnd = new Random(); _enabled = true; RunAsync().GetAwaiter().OnCompleted(()=>{}); }
public ReportParameters(List<int> requiredUsers, Session session, Topic topic, Discussion discussion) { this.requiredUsers = requiredUsers; this.sessionTopicUsers = topic.Person.Select(pers => pers.Id).Intersect(requiredUsers); this.session = session; this.topic = topic; this.discussion = discussion; }
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 ArgPointReport(int numPoints, int numPointsWithDescriptions, int numMediaAttachments, int numSources, int numComments, Person user, Topic topic) { this.numPoints = numPoints; this.numPointsWithDescriptions = numPointsWithDescriptions; this.numMediaAttachments = numMediaAttachments; this.numSources = numSources; this.numComments = numComments; this.user = user; this.topic = topic; }
string BuildParticipantsString(Topic topic) { var topicParticipants = topic.Person.Select(p => p.Name).ToArray(); var sb = new StringBuilder(); foreach (var topicParticipant in topicParticipants) { sb.Append(topicParticipant); if (topicParticipant != topicParticipants.Last()) sb.AppendLine(","); } return sb.ToString(); }
public void Run(Session session, Topic topic, Discussion discussion, Person person) { //tests //var ctx = new DiscCtx(ConfigManager.ConnStr); //var discussion = ctx.Discussion.First(); //var topic = discussion.Topic.First(); //var session = ctx.Session.FirstOrDefault(); //var pers = session.Person.First(); //start hard report var reportParameters = new ReportParameters(session.Person.Select(p => p.Id).ToList(), session, topic, discussion); var tcs = new TaskCompletionSource<ReportCollector>(); new ReportCollector(null, ReportGenerated, reportParameters, tcs, UISharedRTClient.Instance.clienRt); var pdfAsm = new Reporter.pdf.PdfAssembler2(discussion, topic, person, session, Utils.RandomFilePath(".pdf"), tcs.Task, RemoteFinalSceneScreenshot(topic.Id, discussion.Id)); pdfAsm.RunAsync().GetAwaiter().OnCompleted(() => { }); }
public PdfAssembler2(Discussion discussion, Topic topic, Person person, Session session, string PdfPathName, Task<ReportCollector> hardReportTask, Task<Dictionary<int, byte[]>> finalScene) { _discussion = discussion; _topic = topic; _PdfPathName = PdfPathName; _person = person; _session = session; _hardReportTask = hardReportTask; _finalScene = finalScene; if (topic == null) { MessageDlg.Show("Null topic"); } if (discussion == null) { MessageDlg.Show("Null discussion"); } }
public static IEnumerable<Tuple<Person,Person>> ParticipantsTuples(Topic topic, Session session) { var participants = Participants(topic, session); var res = new List<Tuple<Person, Person>>(); Person prev = null; foreach (var current in participants) { if (prev != null) { res.Add(new Tuple<Person, Person>(prev,current)); prev = null; } else prev = current; } if (prev != null) res.Add(new Tuple<Person, Person>(prev, null)); return res; }
public List<int> accumulatedParticipants; //only used for totals/avg etc, more than single topic public TopicReport(Topic topic, int numClusters, int numClusteredBadges, int numLinks, int numSources, int numComments, int cumulativeDuration, int[] clusterIds, int[] linkIds, int numPoints, int numPointsWithDescription, int numMediaAttachments, int numImages, int numPDFs, int numScreenshots, int numYoutubes) { this.topic = topic; this.numClusters = numClusters; this.numClusteredBadges = numClusteredBadges; this.numLinks = numLinks; this.numSources = numSources; this.numComments = numComments; this.cumulativeDuration = cumulativeDuration; this.clusterIds = clusterIds; this.linkIds = linkIds; this.numPoints = numPoints; this.numPointsWithDescription = numPointsWithDescription; this.numMediaAttachments = numMediaAttachments; this.numImages = numImages; this.numPDFs = numPDFs; this.numScreenshots = numScreenshots; this.numYoutubes = numYoutubes; }
private void updateSrcPoints(Topic t) { int selfId = SessionInfo.Get().person.Id; srcPoints.Clear(); if (t == null) return; foreach (var ap in t.ArgPoint.Where(ap0 => ap0.Person.Id == selfId)) srcPoints.Add(ap); }
/// <summary> /// Create a new Topic object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="running">Initial value of the Running property.</param> /// <param name="cumulativeDuration">Initial value of the CumulativeDuration property.</param> public static Topic CreateTopic(global::System.Int32 id, global::System.String name, global::System.Boolean running, global::System.Int32 cumulativeDuration) { Topic topic = new Topic(); topic.Id = id; topic.Name = name; topic.Running = running; topic.CumulativeDuration = cumulativeDuration; return topic; }
/// <summary> /// Deprecated Method for adding a new object to the Topic EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTopic(Topic topic) { base.AddObject("Topic", topic); }
public Discussion cloneDiscussion(DiscCtx ctx, Discussion original, Person moderator, int i) { var d = new Discussion(); d.Subject = injectNumber(original.Subject, i); //copy background d.Background = new RichText(); d.Background.Text = original.Background.Text; foreach (var src in original.Background.Source) { var s = new Source(); s.Text = src.Text; s.OrderNumber = src.OrderNumber; d.Background.Source.Add(s); } foreach (var media in original.Attachment) { var attach = new Attachment(); attach.Discussion = d; attach.Format = media.Format; attach.Link = media.Link; attach.Name = media.Name; attach.Title = media.Title; attach.VideoEmbedURL = media.VideoEmbedURL; attach.VideoLinkURL = media.VideoLinkURL; attach.VideoThumbURL = media.VideoThumbURL; attach.OrderNumber = media.OrderNumber; if (media.Thumb != null) attach.Thumb = (byte[]) media.Thumb.Clone(); if (media.MediaData != null && media.MediaData.Data != null) { var mediaClone = new MediaData(); mediaClone.Data = (byte[]) media.MediaData.Data.Clone(); attach.MediaData = mediaClone; } attach.Person = moderator; d.Attachment.Add(attach); } d.HtmlBackground = original.HtmlBackground; foreach (var topic in original.Topic) { var t = new Topic(); t.Name = injectNumber(topic.Name, i); t.Person.Add(moderator); d.Topic.Add(t); } return d; }
void RestoreUnsolvedGroupsOfCurrentTopic(Topic t) { Dictionary<int, Group> groupCodeToUnsolvedGroups = new Dictionary<int, Group>(); foreach (ArgPoint p in allTopicsItems) { if (p.AgreementCode== (int)AgreementCode.UnsolvedAndGrouped) { if (p.Group != null) if (!groupCodeToUnsolvedGroups.ContainsKey(p.Group.Id)) groupCodeToUnsolvedGroups.Add(p.Group.Id, p.Group); } } foreach (var group in groupCodeToUnsolvedGroups.Values) { if (group.ArgPoint.Count > 0 && group.ArgPoint.First().Topic.Id == t.Id) putBadgeFolderTo(group, unsolvedCurrentTopicItems); } }
private void btnAddTopic_Click(object sender, RoutedEventArgs e) { if (EditedDiscussion == null) return; Topic top = new Topic(); top.Name = "Topic name"; EditedDiscussion.Topic.Add(top); lstBoxTopics.SelectedItem = top; foreach (var p in tmpPersons) top.Person.Add(p); }
private void SaveParticipants(Topic t = null) { if (t == null) t = EditedTopic; if (t == null || EditedDiscussion == null) return; foreach (Topic top in EditedDiscussion.Topic) { top.Person.Clear(); foreach (var p in tmpPersons) { if (p.Name == "Name") continue; bool prevExists; Person prev = DaoUtils.PersonSingleton(p, out prevExists); if (!top.Person.Contains(prev)) top.Person.Add(prev); } } PublicBoardCtx.Get().SaveChanges(); }
private void copyArgPointTo(ArgPoint ap, Topic t) { var pointCopy = DaoUtils.clonePoint(PrivateCenterCtx.Get(), ap, t, SessionInfo.Get().person, ap.Point + "_Copy"); operationPerformed = true; Close(); }
private void btnOk_Click_1(object sender, RoutedEventArgs e) { if (lstSessions.SelectedItem == null || lstTopics.SelectedItem == null) { MessageDlg.Show("Please select session and topic to generate report"); return; } _session = lstSessions.SelectedItem as Session; _topic = lstTopics.SelectedItem as Topic; _users = new List<int>(); foreach (var pers in _session.Person) _users.Add(pers.Id); _reportParameters = new ReportParameters(Users, session, topic, lstDiscussions.SelectedItem as Discussion); Close(); }
void GetUnsolvedPointsOfCurrentTopic(Topic topic) { unsolvedCurrentTopicItems.Clear(); foreach (ArgPoint pt in allTopicsItems) { if (pt.Topic == topic && pt.AgreementCode == (int)AgreementCode.Unsolved) { unsolvedCurrentTopicItems.Add(pt); } } RestoreUnsolvedGroupsOfCurrentTopic(topic); }
private void RenumberPointsAfterDeletion(Topic t, int selfId) { //points follow in order of OrderNumber int nextOrderNr = 1; foreach (var ap in t.ArgPoint.Where(ap0 => ap0.Person.Id == selfId).OrderBy(ap0 => ap0.OrderNumber)) { ap.OrderNumber = nextOrderNr++; } }
public AttachmentBot() { _topic = SessionInfo.Get().discussion.Topic.First(); _rnd = new Random(); }
private void btnOk_Click_1(object sender, RoutedEventArgs e) { if (lstTopics.SelectedItem == null) { MessageDlg.Show("Please select topic"); return; } _topic = lstTopics.SelectedItem as Topic; _html = lstFormat.SelectedIndex == 0; Close(); }
public static void ArgPointTotalsOverTopic(ReportParameters par, Topic topic, out int numSrc, out int numComments, out int numImages, out int numPdfs, out int numScreenshots, out int numYoutubes) { numSrc = 0; numComments = 0; numImages = 0; numPdfs = 0; numScreenshots = 0; numYoutubes = 0; foreach (var pt in topic.ArgPoint) { if (par.requiredUsers.Contains(pt.Person.Id)) { numSrc += pt.Description.Source.Count(); foreach (var a in pt.Attachment) { switch ((AttachmentFormat) a.Format) { case AttachmentFormat.None: break; case AttachmentFormat.Jpg: numImages++; break; case AttachmentFormat.Png: numImages++; break; case AttachmentFormat.Bmp: numImages++; break; case AttachmentFormat.Pdf: numPdfs++; break; case AttachmentFormat.Youtube: numYoutubes++; break; case AttachmentFormat.GeneralWebLink: break; case AttachmentFormat.PngScreenshot: numScreenshots++; break; case AttachmentFormat.WordDocSet: break; case AttachmentFormat.ExcelDocSet: break; case AttachmentFormat.PowerPointDocSet: break; default: throw new NotSupportedException(); } } } foreach (var c in pt.Comment) { if (c.Person == null) return; if (c.Text != "New feedback" && par.requiredUsers.Contains(c.Person.Id)) ++numComments; } } }
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; }
public static IEnumerable<ArgPoint> ArgPointsOf(Person pers, Discussion d, Topic t) { return pers.ArgPoint.Where(ap => ap.Topic != null && ap.Topic.Id == t.Id); }
private void UpdatePointsOfTopic(Topic t) { OwnArgPoints.Clear(); if (t == null) { theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = null; return; } int selfId = SessionInfo.Get().person.Id; foreach (var ap in t.ArgPoint.Where(ap0 => ap0.Person.Id == selfId).OrderBy(ap0 => ap0.OrderNumber)) OwnArgPoints.Add(new ArgPointExt(ap)); UpdateLocalUnreadCountsOwn(TimingCtx.GetFresh()); if (OwnArgPoints.Count > 0) { lstPoints.SelectedItem = OwnArgPoints.First(); theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = OwnArgPoints.First().Ap; } else { theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = null; } }
public static IEnumerable<Person> Participants(Topic topic, Session session) { var topId = topic.Id; return session.Person.Where(p => p.Topic.Any(t => t.Id == topId)); }