Пример #1
0
        void Instance_MsgArrivedEvent(object msg)
        {
            IDisplayItem alert = (IDisplayItem)msg;

            this.displayQue.Add(alert);
            Invoke(new EventHandler(DisplayAlert));
        }
Пример #2
0
 static public void DisplayAlert(IDisplayItem msg)
 {
     if (instance == null)
     {
         instance = new AlertScreen();
     }
     instance.Display(msg);
 }
Пример #3
0
        /// <summary>
        /// this ActionScript object is bound to an item
        /// </summary>
        /// <param name="item"></param>
        /// the item that this context is bound to
        public ObjectContext(IDisplayItem item)
        {
            Variables = Variables = new Dictionary <string, Value>(StringComparer.OrdinalIgnoreCase);
            Constants = new List <Value>();
            Item      = item;

            //initialize item dependent properties
            InitializeProperties();
        }
Пример #4
0
        public DisplayItem(IDisplayItem displayItem)
        {
            this.InitializeComponent();

            if (displayItem == null)
                throw new ArgumentNullException("displayItem");

            this.DataContext = displayItem;
        }
Пример #5
0
        public DisplayItem(IDisplayItem displayItem)
        {
            this.InitializeComponent();

            if (displayItem == null)
            {
                throw new ArgumentNullException("displayItem");
            }

            this.DataContext = displayItem;
        }
Пример #6
0
 /// <summary>
 /// Indicates whether the current <see cref="DisplayItem"/>'s <see cref="Value"/> equals the other <see cref="IDisplayItem"/>'s <see cref="IDisplayItem.Value"/>.
 /// </summary>
 /// <param name="other">An <see cref="IDisplayItem"/> to compare with this <see cref="DisplayItem"/>.</param>
 /// <returns>
 /// <c>true</c> if the current <see cref="DisplayItem"/> has the same <see cref="Value"/> object as the <paramref name="other"/> <see cref="IDisplayItem"/> parameter; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(IDisplayItem other)
 {
     if (Value == null)
     {
         return(other.Value == null);
     }
     if (other.Value == null)
     {
         return(false);
     }
     return(Value.Equals(other.Value));
 }
Пример #7
0
        private void AddDisplayItem(IDisplayItem displayItem)
        {
            var item = new DisplayItem(displayItem);

            item.Visibility = System.Windows.Visibility.Hidden;

            ScrollCanvas.Children.Add(item);

            Canvas.SetTop(item, 0);
            Canvas.SetLeft(item, 0);

            displayItems.AddLast(item);
        }
Пример #8
0
        private void CheckClipboard()
        {
            IDataObject dataObject;

            try
            {
                dataObject = System.Windows.Forms.Clipboard.GetDataObject();
            }
            catch
            {
                // Please don't try this at home.
                return;
            }

            if (dataObject != null)
            {
                if (dataObject.GetDataPresent(DataFormats.Text))
                {
                    string data = dataObject.GetData(DataFormats.Text) as string;

                    if (data != null)
                    {
                        data = data.Trim();
                        Console.WriteLine("Clipboard:" + data);

                        Regex re = new Regex(@"^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d{3}[- .]?\d{4}$", RegexOptions.IgnoreCase);
                        Match m  = re.Match(data);

                        if (m.Success)
                        {
                            PhoneNumberAction msg = new PhoneNumberAction(data);
                            msg.ProcessMessage();
                            IDisplayItem alert = (IDisplayItem)msg;
                            this.displayQue.Add(alert);
                            Invoke(new EventHandler(DisplayAlert));

                            Console.WriteLine("Is a phone number!");
                        }
                        else
                        {
                            Console.WriteLine("NOT a phone number!");
                        }
                    }
                }
            }
        }
Пример #9
0
        public void DisplayAlert(object sender, EventArgs e)
        {
            IDisplayItem msg = null;

            lock (this.displayQue)
            {
                int count = this.displayQue.Count;
                if (count > 0)
                {
                    msg = this.displayQue[0];
                    this.displayQue.RemoveAt(0);
                }
            }

            if (msg != null)
            {
                if (msg.ItemType == DisplayItemType.CLIPBOARD)
                {
                    try
                    {
                        System.Windows.Forms.Clipboard.SetDataObject(((ClipboardAlert)msg).Text, true);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error Writting to Clipboard:" + Environment.NewLine + ex.ToString());
                    }
                }

                if (msg.ItemType == DisplayItemType.STATUS_SCREEN_SHOT ||
                    msg.ItemType == DisplayItemType.SCREEN ||
                    msg.ItemType == DisplayItemType.CLIPBOARD)
                {
                    DisplayScreenShot(msg);
                }
                else if (msg.DisplayAlert && !m_pauseMsgs)
                {
                    AlertScreen.DisplayAlert(msg);
                }

                if (this.activeTab == eTabs.eTab_Home)
                {
                    Display();
                }
            }
        }
Пример #10
0
        private void DisplayScreenShot(IDisplayItem msg)
        {
            //this.Cursor = Cursors.WaitCursor;
            XslCompiledTransform xsl = new XslCompiledTransform();

            xsl.Load(ApplicationSettings.Instance.AppPath + @"\screenShotTab.xslt");


            XsltArgumentList argList = new XsltArgumentList();

            argList.AddParam("systemPath", "", ApplicationSettings.Instance.AppPath);
            argList.AddParam("dataPath", "", ApplicationSettings.Instance.LocalDataPath);
            //argList.AddParam("contactFilter", "", m_contactFilter);
            //argList.AddParam("scrollTop", "", m_scrollTop.ToString());


            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(msg.XML);

            if (Directory.Exists(ApplicationSettings.Instance.LocalDataPath + @"\debug"))
            {
                StreamWriter SW;
                SW = File.CreateText(ApplicationSettings.Instance.LocalDataPath + @"\debug\DisplayScreenShot.xml");
                SW.Write(msg.XML);
                SW.Close();
            }

            XmlDocument outputDocument = new XmlDocument();

            System.Xml.XPath.XPathNavigator outputNavigator = outputDocument.CreateNavigator();
            using (XmlWriter writer = outputNavigator.AppendChild())
            {
                xsl.Transform(xmlDoc, argList, writer);
            }
            webBrowser.DocumentText = outputDocument.OuterXml;

            this.activeTab = eTabs.eTab_ScreenShot;
        }
Пример #11
0
        private void Display(IDisplayItem msg)
        {
            if (msg != null)
            {
                m_displaying   = true;
                timer.Interval = msg.DisplayInterval;
                m_Opacity      = msg.Opacity;
                m_playSound    = msg.PlaySound;
                if (m_playSound)
                {
                    setSoundFile(msg.SoundFile);
                }

                string html = msg.HTML;

                if (html != null && html.Length > 0)
                {
                    //FIX m_form.setMsgIcon();
                    ClientSize = new System.Drawing.Size(320, 68);
                    webBrowser.DocumentText = html;

                    if (Directory.Exists(ApplicationSettings.Instance.LocalDataPath + @"\debug"))
                    {
                        StreamWriter SW;
                        SW = File.CreateText(ApplicationSettings.Instance.LocalDataPath + @"\debug\display.html");
                        SW.Write(html);
                        SW.Close();
                    }
                }
            }
            else
            {
                // display last message
                ShowForm();
            }
        }
Пример #12
0
        private void PositionDisplayItems()
        {
            if (displayItems != null && displayItems.Count > 0)
            {
                ShowLoadingIndicator();
                ScrollCanvas.Dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(delegate(Object state)
                {

                    double primaryHeight = this.ActualHeight;
                    double primaryWidth = primaryHeight / 1.5;
                    double displayCenter = this.ActualWidth / 2;

                    double bubbleWidth =
                        (primaryWidth * BubbleLevel0) +
                        ((primaryWidth * BubbleLevel1) * 2) +
                        ItemPadding * 4;

                    double displayLeft = displayCenter - (bubbleWidth / 2);
                    int centerItemPosition = (int)Math.Ceiling(displayLeft / ((primaryWidth * BubbleLevel2) + ItemPadding)) + 2; // +offsetPosition;
                    displayLeft = displayLeft - ((primaryWidth * BubbleLevel2) + ItemPadding) * ((centerItemPosition - 2));

                    var node = displayItems.First;
                    int displayPosition = (centerItemPosition - 1);

                    while (node != null)
                    {
                        double itemHeight = 0.0, itemWidth = 0.0, itemOpacity = 0.0, itemTop = 0.0;

                        if (displayPosition == 0)
                        {
                            this.CurrentDataItem = (IDisplayItem)node.Value.DataContext;
                            OnChanged(EventArgs.Empty);

                            itemHeight = primaryHeight * BubbleLevel0;
                            itemWidth = primaryWidth * BubbleLevel0;
                            itemOpacity = OpacityLevel0;
                        }
                        else if (displayPosition > 1 || displayPosition < -1)    // Level 2
                        {
                            itemHeight = primaryHeight * BubbleLevel2;
                            itemWidth = primaryWidth * BubbleLevel2;
                            itemOpacity = OpacityLevel2;
                        }
                        else if (displayPosition == 1 || displayPosition == -1) // Level 1
                        {
                            itemHeight = primaryHeight * BubbleLevel1;
                            itemWidth = primaryWidth * BubbleLevel1;
                            itemOpacity = OpacityLevel2;
                        }

                        node.Value.Height = itemHeight;
                        node.Value.Width = itemWidth;
                        node.Value.Opacity = itemOpacity;

                        itemTop = (primaryHeight - itemHeight) / 2;

                        Canvas.SetTop(node.Value, itemTop);

                        if (node.Previous != null)
                            Canvas.SetLeft(node.Value, Canvas.GetLeft(node.Previous.Value) + node.Previous.Value.Width + ItemPadding);
                        else
                            Canvas.SetLeft(node.Value, displayLeft);

                        node.Value.Visibility = System.Windows.Visibility.Visible;

                        node = node.Next;
                        displayPosition--;
                    }

                   return null;
                }), null);

                HideLoadingIndicator();
            }
        }
Пример #13
0
        private void AddDisplayItem(IDisplayItem displayItem)
        {
            var item = new DisplayItem(displayItem);

            item.Visibility = System.Windows.Visibility.Hidden;

            ScrollCanvas.Children.Add(item);

            Canvas.SetTop(item, 0);
            Canvas.SetLeft(item, 0);

            displayItems.AddLast(item);
        }
 public bool Equals(IDisplayItem other)
 {
     return((other is EmergencyLightMenu) && ((EmergencyLightMenu)other).Siren == Siren);
 }
Пример #15
0
 public void ReRenderItem(IDisplayItem Item)
 {
     try
     {
         lock (Items)
         {
             if (Items.Contains(Item))
             {
                 int i = Items.IndexOf(Item);
                 Rectangle itemBounds = new Rectangle(0, ClientSettings.ItemHeight * i, Item.Bounds.Width, ClientSettings.ItemHeight);
                 Item.Render(_RenderedGraphics, itemBounds);
             }
         }
     }
     catch (Exception)
     {
         //System.Windows.Forms.MessageBox.Show(ex.Message);
     }
 }
Пример #16
0
 public void AddItemToEnd(IDisplayItem Item)
 {
     lock (Items)
     {
         Items.Add(Item);
         if (Items.Count > MaxItems)
         {
             Items.RemoveAt(0);
             Items.TrimExcess();
             RenderNewItemAtEnd();
         }
     }
 }
Пример #17
0
 public void SetItemList(List<IDisplayItem> SetOfItems)
 {
     IDisplayItem FirstNewItem = SetOfItems[0];
     int SpacesMoved = 0;
     lock (Items)
     {
         if (Items.Contains(FirstNewItem) && SetOfItems.Count > SpacesMoved)
         {
             try
             {
                 //Items added to the end
                 SpacesMoved = Items.IndexOf(FirstNewItem);
                 IDisplayItem[] ItemsToAdd = new IDisplayItem[SpacesMoved];
                 Array.Copy(SetOfItems.ToArray(), SetOfItems.Count - SpacesMoved, ItemsToAdd, 0, SpacesMoved);
                 System.Diagnostics.Debug.WriteLine("Blitting " + SpacesMoved + " to the end of the image.");
                 AddItemsToEnd(ItemsToAdd);
                 return;
             }
             catch (ArgumentOutOfRangeException) { }
         }
         else
         {
             try
             {
                 IDisplayItem LastNewItem = SetOfItems[SetOfItems.Count - 1];
                 if (Items.Contains(LastNewItem))
                 {
                     //Items added to the start
                     SpacesMoved = MaxItems - (Items.IndexOf(LastNewItem) + 1);
                     IDisplayItem[] ItemsToAdd = new IDisplayItem[SpacesMoved];
                     Array.Copy(SetOfItems.ToArray(), 0, ItemsToAdd, 0, SpacesMoved);
                     System.Diagnostics.Debug.WriteLine("Blitting " + SpacesMoved + " to the start of the image.");
                     AddItemsToStart(ItemsToAdd);
                     return;
                 }
             }
             catch (ArgumentOutOfRangeException) { }
         }
         System.Diagnostics.Debug.WriteLine("Jumped " + SpacesMoved + " spaces");
         Items.Clear();
         Items = new List<IDisplayItem>(SetOfItems);
         if (Items.Count > MaxItems)
         {
             Items.RemoveRange(MaxItems, Items.Count - MaxItems);
         }
     }
     Rerender();
 }
Пример #18
0
 public OutputEventArgs(IDisplayItem item)
 {
     Item = item;
 }
Пример #19
0
 public void AddItem(IDisplayItem item)
 {
     _itemInFolder.Add(item);
 }
Пример #20
0
 public void AddItemsToStart(IDisplayItem[] Items)
 {
     lock (Items)
     {
         for (int i = Items.Length - 1; i >= 0; i--)
         {
             AddItemToStart(Items[i]);
         }
         NewImage();
     }
 }
Пример #21
0
 public void AddItemsToEnd(IDisplayItem[] Items)
 {
     lock (Items)
     {
         foreach (IDisplayItem Item in Items)
         {
             AddItemToEnd(Item);
         }
     }
     NewImage();
 }
Пример #22
0
 public void AddItemToStart(IDisplayItem Item)
 {
     lock (Items)
     {
         Items.Insert(0, Item);
         if (Items.Count > MaxItems)
         {
             Items.RemoveAt(Items.Count - 1);
             Items.TrimExcess();
             RenderNewItemAtStart();
         }
     }
 }
Пример #23
0
        private void PositionDisplayItems()
        {
            if (displayItems != null && displayItems.Count > 0)
            {
                ShowLoadingIndicator();
                ScrollCanvas.Dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(delegate(Object state)
                {
                    double primaryHeight = this.ActualHeight;
                    double primaryWidth  = primaryHeight / 1.5;
                    double displayCenter = this.ActualWidth / 2;

                    double bubbleWidth =
                        (primaryWidth * BubbleLevel0) +
                        ((primaryWidth * BubbleLevel1) * 2) +
                        ItemPadding * 4;

                    double displayLeft     = displayCenter - (bubbleWidth / 2);
                    int centerItemPosition = (int)Math.Ceiling(displayLeft / ((primaryWidth * BubbleLevel2) + ItemPadding)) + 2; // +offsetPosition;
                    displayLeft            = displayLeft - ((primaryWidth * BubbleLevel2) + ItemPadding) * ((centerItemPosition - 2));

                    var node            = displayItems.First;
                    int displayPosition = (centerItemPosition - 1);

                    while (node != null)
                    {
                        double itemHeight = 0.0, itemWidth = 0.0, itemOpacity = 0.0, itemTop = 0.0;

                        if (displayPosition == 0)
                        {
                            this.CurrentDataItem = (IDisplayItem)node.Value.DataContext;
                            OnChanged(EventArgs.Empty);

                            itemHeight  = primaryHeight * BubbleLevel0;
                            itemWidth   = primaryWidth * BubbleLevel0;
                            itemOpacity = OpacityLevel0;
                        }
                        else if (displayPosition > 1 || displayPosition < -1)    // Level 2
                        {
                            itemHeight  = primaryHeight * BubbleLevel2;
                            itemWidth   = primaryWidth * BubbleLevel2;
                            itemOpacity = OpacityLevel2;
                        }
                        else if (displayPosition == 1 || displayPosition == -1) // Level 1
                        {
                            itemHeight  = primaryHeight * BubbleLevel1;
                            itemWidth   = primaryWidth * BubbleLevel1;
                            itemOpacity = OpacityLevel2;
                        }

                        node.Value.Height  = itemHeight;
                        node.Value.Width   = itemWidth;
                        node.Value.Opacity = itemOpacity;

                        itemTop = (primaryHeight - itemHeight) / 2;

                        Canvas.SetTop(node.Value, itemTop);

                        if (node.Previous != null)
                        {
                            Canvas.SetLeft(node.Value, Canvas.GetLeft(node.Previous.Value) + node.Previous.Value.Width + ItemPadding);
                        }
                        else
                        {
                            Canvas.SetLeft(node.Value, displayLeft);
                        }

                        node.Value.Visibility = System.Windows.Visibility.Visible;

                        node = node.Next;
                        displayPosition--;
                    }

                    return(null);
                }), null);

                HideLoadingIndicator();
            }
        }