Ejemplo n.º 1
0
        public NotifierUI(Point startRenderPoint, VmosoTileDisplayRecord displayRecord, Size expectedSize)
        {
            Rectangle workingArea = System.Windows.Forms.Screen.GetWorkingArea(this);

            if (expectedSize.Width > 0 && expectedSize.Height > 0)
            {
                this.expectedSize = expectedSize;
                this.ClientSize   = expectedSize;
            }
            else
            {
                this.expectedSize = new Size((int)(workingArea.Width * 0.14), (int)(workingArea.Height * 0.07));
                this.ClientSize   = new Size((int)(workingArea.Width * 0.14), (int)(workingArea.Height * 0.07));
            }

            this.startRenderPoint = startRenderPoint;
            this.StartPosition    = FormStartPosition.Manual;
            this.FormBorderStyle  = FormBorderStyle.None;
            this.interval         = defaultAppearingTimerInterval;
            this.timer.Tick      += new EventHandler(OnTick);
            this.moveTimer.Tick  += new EventHandler(MoveTimerEvent);
            this.realBarHeight    = this.ClientSize.Height;
            this.realBarWidth     = this.ClientSize.Width;
            this.displayRecord    = displayRecord;
            this.ShowInTaskbar    = false;
            InitializeForm();
        }
Ejemplo n.º 2
0
        public void Add(VmosoTileDisplayRecord displayRecord, VmosoSession session)
        {
            notifierQueue.Enqueue(displayRecord);

            if (add != null)
            {
                add(this, new NotifierEventArgs(displayRecord, session));
            }
        }
Ejemplo n.º 3
0
        // Check if current message belongs to "today"
        protected bool CanShow(VmosoTileDisplayRecord record)
        {
            double secondOfDay = 86400;
            double timestamp   = ConvertToLocalUnixTime(record.timestamp);

            double unixTimesCap = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Local)).TotalSeconds;
            double daysCap      = (int)(unixTimesCap / secondOfDay);
            double startTime    = daysCap * secondOfDay;
            double endTime      = secondOfDay * (daysCap + 1);

            if (timestamp >= startTime && timestamp < endTime)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public void ShowMostRecentMessage()
        {
            if (mostRecentQueue.Count == 0 || canShowRecentMessage == false)
            {
                return;
            }

            canShowRecentMessage = false;

            Point recentMessageTopPoint = new Point();

            recentMessageTopPoint.X = workingArea.X + workingArea.Width - expectedSize.Width;
            recentMessageTopPoint.Y = workingArea.Y + workingArea.Height;

            Size formSize = new Size(this.expectedSize.Width, 0);
            int  xOffset  = 3;

            Size controlPaneSize = new Size(this.expectedSize.Width - xOffset * 2, (int)(this.expectedSize.Height * 0.25));

            MostRecentControlPane controlPane = new MostRecentControlPane(controlPaneSize);

            controlPane.Render();

            recentMessageForm           = new MostRecentMessageForm(formSize, recentMessageTopPoint);
            recentMessageForm.TopMost   = true;
            recentMessageForm.Disposed += MostRecentMessage_FormDisposed;
            recentMessageForm.AddMessageControl(controlPane);

            IEnumerator <VmosoTileDisplayRecord> enumerator = mostRecentQueue.GetEnumerator();

            int elementIndex = 0;

            while (enumerator.MoveNext())
            {
                elementIndex++;
                VmosoTileDisplayRecord displayRecord = enumerator.Current;

                Size typeIconPaneSize = new Size(this.expectedSize.Width - xOffset * 2, (int)(this.expectedSize.Height * 0.25));
                Size summaryPaneSize  = new Size(this.expectedSize.Width - xOffset * 2, (int)(this.expectedSize.Height * 0.375));
                Size personalPaneSize = new Size(this.expectedSize.Width - xOffset * 2, (int)(this.expectedSize.Height * 0.375) - 3);

                TypeIconPane typeIconPane = elementIndex == mostRecentQueue.Count ? new TypeIconPane(typeIconPaneSize, displayRecord, true) : new TypeIconPane(typeIconPaneSize, displayRecord, false);
                SummaryPane  summaryPane  = new SummaryPane(summaryPaneSize, displayRecord);
                PersonalPane personalPane = new PersonalPane(personalPaneSize, displayRecord, Session);

                typeIconPane.Render();
                summaryPane.Render();
                personalPane.Render();

                recentMessageForm.AddTile(personalPane);
                recentMessageForm.AddTile(summaryPane);

                if (elementIndex == mostRecentQueue.Count)
                {
                    recentMessageForm.AddTile(typeIconPane);
                }
            }

            recentMessageForm.Render();
            recentMessageForm.Show();

            showMessageTimer.Start();
        }
Ejemplo n.º 5
0
 public void InitializeDisplayRecord(VmosoTileDisplayRecord displayRecord)
 {
     this.displayRecord = displayRecord;
 }
Ejemplo n.º 6
0
 public VmosoNotifierTile(Point startRenderPoint, VmosoTileDisplayRecord displayRecord, Size expectedSize, VmosoSession session)
     : base(startRenderPoint, displayRecord, expectedSize)
 {
     this.Session = session;
     InitializeVmosoTile();
 }