Ejemplo n.º 1
0
 public static void SetStyleWithType(this FrameworkElement element, Style style)
 {
     if (element.Style != style && (style == null || style.TargetType != null))
     {
         element.Style = style;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Section with specified Style
 /// </summary>
 /// <param Name="style">The Style the generated paragraph should be rendered in</param>
 /// <param Name="paragraphLength">The mean length of the paragraph</param>
 /// <param Name="paragraphVariance">The standard deviation of paragraph length</param>
 public Section(Style style, int paragraphLength, int paragraphVariance)
 {
     Style = style;
     NextSection = new SectionSelector();
     ParagraphLength = paragraphLength;
     ParagraphVariance = paragraphVariance;
 }
        public static bool ContainsStyle(Style style, System.Collections.ArrayList styles) {
            foreach (Style s in styles)
                if (s == style)
                    return true;

            return false;
        }
Ejemplo n.º 4
0
 public Style(string tag, string tagClass, string properties, Style next)
 {
     Tag = tag;
     TagClass = tagClass;
     Properties = properties;
     Next = next;
 }
Ejemplo n.º 5
0
        public static void SetRandomWallpaperFromPath(FileInfo file, Style style)
        {
            if (file == null) return;

            SystemParametersInfo(SetDesktopWallpaper, 0, file.ToString(), UpdateIniFile | SendWinIniChange);
            var key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);

            if (key == null) return;

            switch (style)
            {
                case Style.Stretch:
                    key.SetValue(@"WallpaperStyle", "2");
                    key.SetValue(@"TileWallpaper", "0");
                    break;
                case Style.Center:
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "0");
                    break;
                case Style.Tile:
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "1");
                    break;
                case Style.NoChange:
                    break;
            }

            key.Close();
        }
Ejemplo n.º 6
0
        public static void Set(string file, Style style)
        {
            var wpKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretch)
            {
                wpKey?.SetValue(@"WallpaperStyle", 2.ToString());
                wpKey?.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Center)
            {
                wpKey?.SetValue(@"WallpaperStyle", 1.ToString());
                wpKey?.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Tile)
            {
                wpKey?.SetValue(@"WallpaperStyle", 1.ToString());
                wpKey?.SetValue(@"TileWallpaper", 1.ToString());
            }

            if (style == Style.Fit)
            {
                wpKey?.SetValue(@"WallpaperStyle", 6.ToString());
                wpKey?.SetValue(@"TileWallpaper", 0.ToString());
            }

            var bgKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Colors", true);
            bgKey?.SetValue(@"Background", "0 0 0");

            SystemParametersInfo(SPI_SETDESKWALLPAPER,
                0,
                file,
                SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
        public static string HeaderPrint(string s, Style style)
        {
            if (s.Length > Stars.Length - 2)
                throw new Exception("Update HeaderPrinter");

            switch (style)
            {
                case Style.Left:
                    return string.Format(
                        "*{0}{1}*",
                        s, Pad(Stars.Length - s.Length - 2));
                case Style.CenterCaps:
                {
                    var totalPad = Stars.Length - 2 - s.Length;

                    var leftPad = totalPad/2;
                    var rightPad = totalPad - leftPad;

                    return string.Format(
                        "*{0}{1}{2}*",
                        Pad(leftPad), s.ToUpper(), Pad(rightPad));
                }

                default:
                    throw new NotImplementedException("Update HeaderPrinter");
            }
        }
		public DeviceStylesPageCS ()
		{
			var myBodyStyle = new Style (typeof(Label)) {
				BaseResourceKey = Device.Styles.BodyStyleKey,
				Setters = {
					new Setter {
						Property = Label.TextColorProperty,
						Value = Color.Accent
					} 
				}
			};

			Title = "Device";
			Icon = "csharp.png";
			Padding = new Thickness (0, 20, 0, 0);

			Content = new StackLayout { 
				Children = {
					new Label { Text = "Title style", Style = Device.Styles.TitleStyle },
					new Label { Text = "Subtitle style", Style = Device.Styles.SubtitleStyle },
					new Label { Text = "Body style", Style = Device.Styles.BodyStyle }, 
					new Label { Text = "Caption style", Style = Device.Styles.CaptionStyle },
					new Label { Text = "List item detail text style", Style = Device.Styles.ListItemDetailTextStyle },
					new Label { Text = "List item text style", Style = Device.Styles.ListItemTextStyle },
					new Label { Text = "No style" }, 
					new Label { Text = "My body style", Style = myBodyStyle }
				}
			};
		}
Ejemplo n.º 9
0
 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     this.BorderColor=_officeColorTable.TextBoxBorderColor;
     //_startPaint = true;
     this.Refresh();
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Set desktop wallpaper
        /// </summary>
        /// <param name="uri">Image filename</param>
        /// <param name="style">Style of wallpaper</param>
        public static void Set(Uri uri, Style style)
        {
            Stream s = new System.Net.WebClient().OpenRead(uri.ToString());

            System.Drawing.Image img = System.Drawing.Image.FromStream(s);
            Set(img, style);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Set desktop wallpaper
        /// </summary>
        /// <param name="img">Image data</param>
        /// <param name="style">Style of wallpaper</param>
        public static void Set(System.Drawing.Image img, Style style)
        {
            try
            {
                string tempPath = Path.Combine(Path.GetTempPath(), "imageglass.jpg");
                img.Save(tempPath, System.Drawing.Imaging.ImageFormat.Jpeg);

                RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
                if (key == null)
                    return;

                if (style == Style.Stretched)
                {
                    key.SetValue(@"WallpaperStyle", "2");
                    key.SetValue(@"TileWallpaper", "0");
                }

                if (style == Style.Centered)
                {
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "0");
                }

                if (style == Style.Tiled)
                {
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "1");
                }

                SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, tempPath, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
            }
            catch (Exception) { }
        }
Ejemplo n.º 12
0
            public PlayerZones(int playerIndex, Style.IStyleContainer parent, XElement styleDefinition)
            {
                var layout = new Style.LayoutGizmo<UI.TransformNode>(parent, styleDefinition);
                layout.Initialize();
                layout.Target.Dispatcher = parent.Target;
                layout.BindingProvider = this;
                UIStyle = layout;
                PlayerIndex = playerIndex;

                m_manaTextEvaluator = GameApp.Service<GameManager>().CreateGameEvaluator(game =>
                {
                    var player = game.Players[PlayerIndex];
                    return player.Mana != 0 || player.MaxMana != 0
                           ? player.Mana.ToString() + "/" + player.MaxMana.ToString()
                           : "0";
                }, "-");

                Library = new CardZone(UIStyle.ChildIds["Library"]);
                Hand = new CardZone(UIStyle.ChildIds["Hand"]);
                Sacrifice = new CardZone(UIStyle.ChildIds["Sacrifice"]);
                Battlefield = new CardZone(UIStyle.ChildIds["Battlefield"]);
                Hero = new CardZone(UIStyle.ChildIds["Hero"]);
                Assists = new CardZone(UIStyle.ChildIds["Assists"]);
                Graveyard = new CardZone(UIStyle.ChildIds["Graveyard"]);
            }
Ejemplo n.º 13
0
        protected override void DrawContent(int left, int top, int width, int height, Style cStyle)
        {
            if (_image == null) return;

            int imgWidth = _image.Width, imgHeight = _image.Height;
            _desktopOwner._screenBuffer.DrawImage(left + (width - imgWidth) / 2, top + (height - imgHeight) / 2, _image, 0, 0, imgWidth, imgHeight, _enabled ? (ushort)256 : (ushort)100);
        }
 public void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
 {
   ListViewItemGenerator icg = (ListViewItemGenerator) source;
   _itemTemplate = copyManager.GetCopy(icg._itemTemplate);
   _itemContainerStyle = copyManager.GetCopy(icg._itemContainerStyle);
   _parent = copyManager.GetCopy(icg._parent);
   if (icg._items == null)
     _items = null;
   else
   {
     _items = new List<object>(icg._items.Count);
     foreach (object item in icg._items)
       _items.Add(copyManager.GetCopy(item));
   }
   _populatedStartIndex = icg._populatedStartIndex;
   _populatedEndIndex = icg._populatedEndIndex;
   if (icg._materializedItems == null)
     _materializedItems = null;
   else
   {
     _materializedItems = new List<FrameworkElement>(icg._materializedItems.Count);
     foreach (FrameworkElement item in icg._materializedItems)
       _materializedItems.Add(copyManager.GetCopy(item));
   }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Constructor of a tree control with a particular style and renderer</summary>
        /// <param name="style">Tree style</param>
        /// <param name="itemRenderer">Renderer of a node in the tree. If null, then a new
        /// TreeItemRenderer is created and used</param>
        public TreeControl(Style style, TreeItemRenderer itemRenderer)
        {
            m_style = style;
            if (m_style == Style.CategorizedPalette)
                m_showRoot = false;

            m_root = new Node(this, null, null);

            m_dragHoverExpandTimer = new Timer();
            m_dragHoverExpandTimer.Interval = 1000; // 1 second delay for drag hover expand
            m_dragHoverExpandTimer.Tick += DragHoverTimerTick;

            m_autoScrollTimer = new Timer();
            m_autoScrollTimer.Interval = 200; // 5 Hz auto scroll rate
            m_autoScrollTimer.Tick += AutoScrollTimerTick;

            m_editLabelTimer = new Timer();
            m_editLabelTimer.Tick += EditLabelTimerTick;

            m_averageRowHeight = FontHeight + Margin.Top;

            SuspendLayout();

            m_textBox = new TextBox();
            m_textBox.Visible = false;
            m_textBox.BorderStyle = BorderStyle.None;

            m_textBox.KeyDown += TextBoxKeyDown;
            m_textBox.KeyPress += TextBoxKeyPress;
            m_textBox.LostFocus += TextBoxLostFocus;

            m_vScrollBar = new VScrollBar();
            m_vScrollBar.Dock = DockStyle.Right;
            m_vScrollBar.SmallChange = m_averageRowHeight;
            m_vScrollBar.ValueChanged += VerticalScrollBarValueChanged;

            m_hScrollBar = new HScrollBar();
            m_hScrollBar.Dock = DockStyle.Bottom;
            m_vScrollBar.SmallChange = 8;
            m_hScrollBar.ValueChanged += HorizontalScrollBarValueChanged;

            Controls.Add(m_vScrollBar);
            Controls.Add(m_hScrollBar);
            Controls.Add(m_textBox);

            ResumeLayout();

            BackColor = SystemColors.Window;

            base.DoubleBuffered = true;

            SetStyle(ControlStyles.ResizeRedraw, true);

            if (itemRenderer == null)
                itemRenderer = new TreeItemRenderer();
            ItemRenderer = itemRenderer;

            m_filterImage = ResourceUtil.GetImage16(Resources.FilterImage) as Bitmap;
            m_toolTip = new ToolTip();
        }
 /// <summary>
 /// Write some text to the output. We need to take care to
 /// remember the lines, so we can reproduce the text later on.
 /// 
 /// For now, we just ignore "style".
 /// </summary>
 public void Write(string text, Style style)
 {
     var lines = text.Split(new string[]{Environment.NewLine}, StringSplitOptions.None);
     if (lines.Length == 1)
     {
         // no newlines in text
         _currentLine.Append(new OutputSpan(lines[0], _font));
     }
     else
     {
         foreach (var line in lines.Take(lines.Length - 1)) // we will treat the last line specially
         {
             _currentLine.Append(new OutputSpan(line, _font));
             _currentLine = new OutputLine(); // start a new line
             _logicalLines.Add(_currentLine);
         }
         var lastline = lines.Last();
         if (lastline != Environment.NewLine)
         {
             // reuse logic for no newlines in text
             Write(lastline, style);
         }
         // else: already handled in foreach: _lines.Add(_currentLine)
     }
     Invalidate();
 }
Ejemplo n.º 17
0
 public static void Set(Uri uri, Style style)
 {
     System.IO.Stream s = new WebClient().OpenRead(uri.ToString());
     //获取壁纸文件,传入到流
     System.Drawing.Image img = System.Drawing.Image.FromStream(s);
     //传入到image中
     string tempPath = Path.Combine(Path.GetTempPath(), "wallpaper.bmp");
     //将壁纸的存储地址设置为Temp目录,并且命名为wallpaper.bmp
     img.Save(tempPath, System.Drawing.Imaging.ImageFormat.Bmp);
     //保存为bmp文件
     RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
     //打开注册表
     //判断壁纸设置的类型,并且将键值写入注册表
     if (style == Style.Stretched)
     {
         key.SetValue(@"WallpaperStyle", 2.ToString());
         key.SetValue(@"TileWallpaper", 0.ToString());
     }
     if (style == Style.Centered)
     {
         key.SetValue(@"WallpaperStyle", 1.ToString());
         key.SetValue(@"TileWallpaper", 0.ToString());
     }
     if (style == Style.Tiled)
     {
         key.SetValue(@"WallpaperStyle", 1.ToString());
         key.SetValue(@"TileWallpaper", 1.ToString());
     }
     //调用方法设置壁纸
     SystemParametersInfo(SPI_SETDESKWALLPAPER,
         0,
         tempPath,
         SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
 }
Ejemplo n.º 18
0
        public static void Set(Uri uri, Style style, ImageFormat format)
        {
            Stream stream = new WebClient().OpenRead(uri.ToString());

            if (stream == null) return;

            Image img = Image.FromStream(stream);
            string tempPath = Path.Combine(Path.GetTempPath(), "img." + format.ToString());
            img.Save(tempPath, format);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            SystemParametersInfo(SpiSetdeskwallpaper,
                0,
                tempPath,
                SpifUpdateinifile | SpifSendwininichange);
        }
Ejemplo n.º 19
0
    public static void Set(string path, Style style)
    {
        RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
        if (style == Style.Stretched)
        {
            key.SetValue(@"WallpaperStyle", 2.ToString());
            key.SetValue(@"TileWallpaper", 0.ToString());
        }

        if (style == Style.Centered)
        {
            key.SetValue(@"WallpaperStyle", 1.ToString());
            key.SetValue(@"TileWallpaper", 0.ToString());
        }

        if (style == Style.Tiled)
        {
            key.SetValue(@"WallpaperStyle", 1.ToString());
            key.SetValue(@"TileWallpaper", 1.ToString());
        }

        SystemParametersInfo(SPI_SETDESKWALLPAPER,
            0,
            path,
            SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
    }
Ejemplo n.º 20
0
        public void StyleForToken_GetsNullForUnknown()
        {
            var subject = new Style();

            Check.That(subject.StyleForToken(_root)).IsNull();
            Check.That(subject[_root]).IsNull();
        }
Ejemplo n.º 21
0
Archivo: Docx.cs Proyecto: samgoat/NC
        public static Style CreateStyle(string name, StyleValues styleType, string fontName = null, int? fontSize = null, bool bold = false, bool italic = false, string hexColour = null, Tabs tabs = null)
        {
            var style = new Style { Type = styleType, StyleId = name };
              var runProps = new StyleRunProperties();
              if (fontName != null)
            runProps.Append(new RunFonts { Ascii = fontName });
              if (fontSize.HasValue)
            runProps.Append(new FontSize { Val = fontSize.Value.ToString() });
              if (bold)
            runProps.Append(new Bold()); //?? this doesn't create bold text, it inverts the existing bold setting
              if (italic)
            runProps.Append(new Italic());
              style.Append(new Name { Val = name });
              if (hexColour != null)
            runProps.Append(new Color { Val = hexColour });
              //style.Append(new BasedOn { Val = "Heading1" });
              //style.Append(new NextParagraphStyle { Val = "Normal" });
              style.Append(runProps);

              if (tabs != null)
              {
            var paragraphProps = new StyleParagraphProperties(tabs);
            style.Append(paragraphProps);
              }
              return style;
        }
Ejemplo n.º 22
0
 internal static unsafe void WriteDesignerStyleAttributes(HtmlMobileTextWriter writer, MobileControl control, Style style)
 {
     Alignment alignment = *((Alignment*) style.get_Item(Style.AlignmentKey, true));
     Wrapping wrapping = *((Wrapping*) style.get_Item(Style.WrappingKey, true));
     Color c = (Color) style.get_Item(Style.BackColorKey, true);
     bool flag = alignment != 0;
     bool flag2 = (wrapping == 1) || (wrapping == 0);
     string str = "100%";
     if (!flag2)
     {
         writer.Write(" style=\"overflow-x:hidden;width:" + str);
     }
     else
     {
         writer.Write(" style=\"word-wrap:break-word;overflow-x:hidden;width:" + str);
     }
     if (c != Color.Empty)
     {
         writer.Write(";background-color:" + ColorTranslator.ToHtml(c));
     }
     if (flag)
     {
         writer.Write(";text-align:" + Enum.GetName(typeof(Alignment), alignment));
     }
 }
Ejemplo n.º 23
0
       public Chart() : base ()
       {
         //SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //the PlotPane is already dbl buffered
         SetStyle(ControlStyles.UserPaint, true);
         SetStyle(ControlStyles.AllPaintingInWmPaint, true); //no ERASE BACKGROUND
         
         SetStyle(ControlStyles.UserMouse, true);

         
         UpdateStyles();
         
         m_Style = new Style(this, null);
         m_RulerStyle = new Style(this, null);
         m_PlotStyle = new Style(this, null);
         
         BuildDefaultStyle(m_Style);
         BuildDefaultRulerStyle(m_RulerStyle);
         BuildDefaultPlotStyle(m_PlotStyle);
         
         
         m_ControllerNotificationTimer = new Timer();
         m_ControllerNotificationTimer.Interval = REBUILD_TIMEOUT_MS;
         m_ControllerNotificationTimer.Enabled = false;
         m_ControllerNotificationTimer.Tick += new EventHandler((o, e) =>
                                                       {
                          //todo ETO NUJNO DLYA DRAG/DROP   if (m_RepositioningColumn!=null || m_ResizingColumn!=null ) return;//while grid is being manipulated dont flush timer just yet
                                                       
                                                        m_ControllerNotificationTimer.Stop(); 
                                                        notifyAndRebuildChart();
                                                       });
       }
Ejemplo n.º 24
0
		public StyleListBox(IStyleSet styleSet, Style style, bool showDefaultStyleItem, bool showOpenDesignerItem) :
			this()
		{
			if (styleSet == null) throw new ArgumentNullException("design");
			if (style == null) throw new ArgumentNullException("style");
			Initialize(styleSet, showDefaultStyleItem, showOpenDesignerItem, style.GetType(), style);
		}
Ejemplo n.º 25
0
        protected override void HandleStartElement(XmlNodeInformation nodeInfo)
        {
            if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("style")))
            {
                Style newStyle = new Style(nodeInfo);
                newStyle.StyleType = nodeInfo.GetAttributeValue(NormalizedVersion("type"));
                m_styles.Add(newStyle.Id, newStyle);
                m_activeStyle = newStyle;
                m_bSendAllToActiveStyle = false;
            }
            else if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("basedOn")))
            {
                m_activeStyle.BasedOn = nodeInfo.GetAttributeValue(NormalizedVersion("val"));
            }
            else if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("name")))
            {
                m_activeStyle.Name = nodeInfo.GetAttributeValue(NormalizedVersion("val"));
            }
            else if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("rPr")))
            {
                m_bSendAllToActiveStyle = true;
            }
            else if (m_bSendAllToActiveStyle)
            {
                if (m_activeStyle != null)
                {
                    nodeInfo.GetAttributes(); // force them to be loaded
                    m_activeStyle.AddProperty(nodeInfo);
                }

            }

        }
Ejemplo n.º 26
0
        public static void Set(String uri, Style style)
        {
            System.Drawing.Image img = Image.FromStream(new System.Net.WebClient().OpenRead(uri.ToString()));

            // 将图片保存到本地目录
            img.Save(Environment.GetEnvironmentVariable("Temp") + "\\" + ImageName, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }
            else if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }
            else if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            // 设置桌面壁纸的API
            SystemParametersInfo(SPI_SETDESKWALLPAPER
                                , 0
                                , Environment.GetEnvironmentVariable("Temp") + "\\" + ImageName
                                , SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
        public static void Set(string uri, Style style)
        {
            System.IO.Stream s = new System.Net.WebClient().OpenRead(uri);

            System.Drawing.Image img = System.Drawing.Image.FromStream(s);
            string tempPath = Path.Combine(Path.GetTempPath(), "wallpaper.bmp");
            img.Save(tempPath, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            SystemParametersInfo(SPI_SETDESKWALLPAPER,
                0,
                tempPath,
                SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
Ejemplo n.º 28
0
        public static void Set(string fileName, Style style)
        {
            string filePath = Path.Combine("Images", fileName);
            Image image = Image.FromFile(filePath, true);
            string tempPath = Path.Combine(Path.GetTempPath(), fileName);
            image.Save(tempPath, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            SystemParametersInfo(SPI_SETDESKWALLPAPER,
                0,
                tempPath,
                SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Sets wallpaper and style
        /// WinowsAPI Call
        /// </summary>
        /// <param name="image"></param>
        /// <param name="style"></param>
        public static void SetWallPaper(BitmapImage image, Style style)
        {
            if (image != null)
            {
                string tempPath = Path.Combine(Path.GetTempPath(), "wallpaper");

                //image.Save(tempPath, System.Drawing.Imaging.ImageFormat.Jpeg)
                JpegBitmapEncoder encoder = new JpegBitmapEncoder();

                try
                {
                    encoder.Frames.Add(BitmapFrame.Create(image));
                }
                catch { }

                using(Stream fs = new FileStream(tempPath, FileMode.Create))
                {
                    encoder.Save(fs);
                }

                SetWallPaperStyle(style);

                //Win API Call
                SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, tempPath, SPIF_UPDATEINIFILE | SPIF_SENDWINIINICHANGE);
            }
        }
Ejemplo n.º 30
0
        private Style GenerateHeadingOneCharStyle()
        {
            Style style1 = new Style() { Type = StyleValues.Character, StyleId = HeadingOneCharStyle, CustomStyle = true };
            StyleName styleName1 = new StyleName() { Val = "Heading 1 Char" };
            BasedOn basedOn1 = new BasedOn() { Val = "DefaultParagraphFont" };
            LinkedStyle linkedStyle1 = new LinkedStyle() { Val = "Heading1" };
            UIPriority uIPriority1 = new UIPriority() { Val = 9 };
            //Rsid rsid1 = new Rsid() { Val = "0013195F" };

            StyleRunProperties styleRunProperties1 = new StyleRunProperties();
            RunFonts runFonts1 = new RunFonts() { AsciiTheme = ThemeFontValues.MajorHighAnsi, HighAnsiTheme = ThemeFontValues.MajorHighAnsi, EastAsiaTheme = ThemeFontValues.MajorEastAsia, ComplexScriptTheme = ThemeFontValues.MajorBidi };
            Color color1 = new Color() { Val = "2E74B5", ThemeColor = ThemeColorValues.Accent1, ThemeShade = "BF" };
            FontSize fontSize1 = new FontSize() { Val = "32" };
            FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "32" };

            styleRunProperties1.Append(runFonts1);
            styleRunProperties1.Append(color1);
            styleRunProperties1.Append(fontSize1);
            styleRunProperties1.Append(fontSizeComplexScript1);

            style1.Append(styleName1);
            style1.Append(basedOn1);
            style1.Append(linkedStyle1);
            style1.Append(uIPriority1);
            //style1.Append(rsid1);
            style1.Append(styleRunProperties1);

            return style1;
        }
Ejemplo n.º 31
0
 public IActionResult CreateStyle(Style formData)
 {
     dbContext.Styles.Add(formData);
     dbContext.SaveChanges();
     return(RedirectToAction("DisplayStylePage"));
 }
Ejemplo n.º 32
0
        public static ContentDialog CreateExportSoundsContentDialog(ObservableCollection <Sound> sounds, DataTemplate itemTemplate, Style listViewItemStyle)
        {
            SoundsList = sounds;
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            ExportSoundsContentDialog = new ContentDialog
            {
                Title                  = loader.GetString("ExportSoundsContentDialog-Title"),
                PrimaryButtonText      = loader.GetString("Export"),
                SecondaryButtonText    = loader.GetString("ContentDialog-Cancel"),
                IsPrimaryButtonEnabled = false
            };

            if (SoundsList.Count == 0)
            {
                ExportSoundsContentDialog.IsPrimaryButtonEnabled = false;
            }

            StackPanel content = new StackPanel
            {
                Orientation = Orientation.Vertical
            };

            ExportSoundsListView = new ListView
            {
                ItemTemplate       = itemTemplate,
                ItemsSource        = SoundsList,
                SelectionMode      = ListViewSelectionMode.None,
                Height             = 300,
                ItemContainerStyle = listViewItemStyle,
                CanReorderItems    = true,
                AllowDrop          = true
            };

            // Create StackPanel with TextBox and Folder button
            StackPanel folderStackPanel = new StackPanel();

            folderStackPanel.Orientation = Orientation.Horizontal;
            folderStackPanel.Margin      = new Thickness(0, 20, 0, 0);

            ExportSoundsFolderTextBox            = new TextBox();
            ExportSoundsFolderTextBox.IsReadOnly = true;
            Button folderButton = new Button
            {
                FontFamily = new FontFamily("Segoe MDL2 Assets"),
                Content    = "\uE838",
                FontSize   = 18,
                Width      = 35,
                Height     = 35
            };

            folderButton.Tapped += ExportSoundsFolderButton_Tapped;

            ExportSoundsAsZipCheckBox = new CheckBox
            {
                Content = loader.GetString("SaveAsZip"),
                Margin  = new Thickness(0, 20, 0, 0)
            };


            folderStackPanel.Children.Add(folderButton);
            folderStackPanel.Children.Add(ExportSoundsFolderTextBox);


            content.Children.Add(ExportSoundsListView);
            content.Children.Add(folderStackPanel);
            content.Children.Add(ExportSoundsAsZipCheckBox);

            ExportSoundsContentDialog.Content = content;
            return(ExportSoundsContentDialog);
        }
Ejemplo n.º 33
0
        public static ContentDialog CreatePlaySoundsSuccessivelyContentDialog(ObservableCollection <Sound> sounds, DataTemplate itemTemplate, Style listViewItemStyle)
        {
            SoundsList = sounds;
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            PlaySoundsSuccessivelyContentDialog = new ContentDialog
            {
                Title               = loader.GetString("PlaySoundsSuccessivelyContentDialog-Title"),
                PrimaryButtonText   = loader.GetString("PlaySoundsSuccessivelyContentDialog-PrimaryButton"),
                SecondaryButtonText = loader.GetString("ContentDialog-Cancel")
            };

            if (SoundsList.Count == 0)
            {
                PlaySoundsSuccessivelyContentDialog.IsPrimaryButtonEnabled = false;
            }

            StackPanel content = new StackPanel
            {
                Orientation = Orientation.Vertical
            };

            SoundsListView = new ListView
            {
                ItemTemplate       = itemTemplate,
                ItemsSource        = SoundsList,
                SelectionMode      = ListViewSelectionMode.None,
                Height             = 300,
                ItemContainerStyle = listViewItemStyle,
                CanReorderItems    = true,
                AllowDrop          = true
            };

            RepeatsComboBox = new ComboBox
            {
                Margin     = new Thickness(0, 10, 0, 0),
                IsEditable = true
            };
            RepeatsComboBox.Items.Add("1");
            RepeatsComboBox.Items.Add("2");
            RepeatsComboBox.Items.Add("3");
            RepeatsComboBox.Items.Add("4");
            RepeatsComboBox.Items.Add("5");
            RepeatsComboBox.Items.Add("6");
            RepeatsComboBox.Items.Add("7");
            RepeatsComboBox.Items.Add("8");
            RepeatsComboBox.Items.Add("9");
            RepeatsComboBox.Items.Add("10");
            RepeatsComboBox.Items.Add("15");
            RepeatsComboBox.Items.Add("20");
            RepeatsComboBox.Items.Add("25");
            RepeatsComboBox.Items.Add("30");
            RepeatsComboBox.Items.Add("40");
            RepeatsComboBox.Items.Add("50");
            RepeatsComboBox.Items.Add("100");
            RepeatsComboBox.Items.Add("∞");
            RepeatsComboBox.SelectedIndex  = 0;
            RepeatsComboBox.TextSubmitted += RepeatsComboBox_TextSubmitted;

            RandomCheckBox = new CheckBox
            {
                Content = loader.GetString("Shuffle"),
                Margin  = new Thickness(0, 10, 0, 0)
            };

            content.Children.Add(SoundsListView);
            content.Children.Add(RepeatsComboBox);
            content.Children.Add(RandomCheckBox);

            PlaySoundsSuccessivelyContentDialog.Content = content;
            return(PlaySoundsSuccessivelyContentDialog);
        }
Ejemplo n.º 34
0
 public static TokenDictionary GetTransitionDictionary(this Style style)
 {
     return(new TokenDictionary(() => GetTransition(style), value => SetTransition(style, value)));
 }
Ejemplo n.º 35
0
 public static void SetTransition(this Style style, string value)
 {
     //
 }
Ejemplo n.º 36
0
 public static string GetTransition(this Style style)
 {
     return(null);
 }
Ejemplo n.º 37
0
        public IActionResult DownloadToPDF(int?id)
        {
            Exam exam = _examManager.Get(id);

            string outputPath = Path.Combine(Path.GetTempPath(), exam.Course.CourseName + ".pdf");

            Document doc = new Document();

            DocumentBuilder docBuilder = new DocumentBuilder(doc);

            Style headerStyle = doc.Styles.Add(StyleType.Paragraph, "HeaderStyle");

            headerStyle.Font.Size = 21;
            headerStyle.Font.Bold = true;
            headerStyle.Font.Name = "Corbel";
            headerStyle.ParagraphFormat.SpaceAfter = 12;
            headerStyle.ParagraphFormat.Alignment  = ParagraphAlignment.Center;

            Style subHeaderStyle = doc.Styles.Add(StyleType.Paragraph, "SubHeaderStyle");

            subHeaderStyle.Font.Size   = 14;
            subHeaderStyle.Font.Italic = true;
            subHeaderStyle.Font.Name   = "Corbel";
            subHeaderStyle.ParagraphFormat.SpaceAfter = 12;
            subHeaderStyle.ParagraphFormat.Alignment  = ParagraphAlignment.Center;

            Style bulletStyle = doc.Styles.Add(StyleType.Paragraph, "bulletStyle");

            bulletStyle.Font.Size = 11;
            bulletStyle.Font.Name = "Calibri";
            bulletStyle.ParagraphFormat.SpaceAfter = 10;
            bulletStyle.ListFormat.List            = doc.Lists.Add(ListTemplate.BulletCircle);
            bulletStyle.ListFormat.ListLevelNumber = 0;


            docBuilder.ParagraphFormat.Style = headerStyle;
            docBuilder.Writeln("Exam " + exam.Course.CourseName + " - " + exam.Course.CourseYear);


            docBuilder.ParagraphFormat.Style = subHeaderStyle;
            docBuilder.Writeln("Date: " + exam.Date.Day.ToString() + "/" + exam.Date.Month.ToString() + "/" + exam.Date.Year.ToString());

            Table      table      = docBuilder.StartTable();
            CellFormat cellFormat = docBuilder.CellFormat;

            docBuilder.RowFormat.HeightRule = HeightRule.Auto;
            docBuilder.ParagraphFormat.ClearFormatting();
            cellFormat.Width = 100;
            docBuilder.InsertCell();
            table.AllowAutoFit = true;
            docBuilder.Writeln("First Name: ");
            docBuilder.InsertCell();
            docBuilder.Writeln("Last Name: ");
            docBuilder.EndRow();
            docBuilder.InsertCell();
            docBuilder.Writeln("Group: ");
            docBuilder.InsertCell();
            docBuilder.Writeln("Year: ");
            docBuilder.EndTable();
            docBuilder.InsertBreak(BreakType.LineBreak);


            int counter = 0;

            foreach (Question question in exam.Course.Questions)
            {
                counter++;

                docBuilder.ParagraphFormat.ClearFormatting();
                docBuilder.StartTable();
                docBuilder.InsertCell();
                docBuilder.RowFormat.HeightRule = HeightRule.Exactly;
                docBuilder.RowFormat.Height     = 30;
                docBuilder.Writeln(counter.ToString() + ". " + question.QuestionPhrase);
                docBuilder.EndRow();
                docBuilder.RowFormat.HeightRule = HeightRule.Exactly;
                docBuilder.RowFormat.Height     = 150;
                docBuilder.InsertCell();


                if (question is QuestionMultipleChoice)
                {
                    QuestionMultipleChoice questionMultipleChoice = (QuestionMultipleChoice)question;

                    foreach (var item in questionMultipleChoice.Answers)
                    {
                        docBuilder.RowFormat.HeightRule  = HeightRule.Auto;
                        docBuilder.ParagraphFormat.Style = bulletStyle;

                        if (questionMultipleChoice.Answers.ToList().IndexOf(item) == questionMultipleChoice.Answers.ToList().Count - 1)
                        {
                            docBuilder.Write(item.Answer);
                        }
                        else
                        {
                            docBuilder.Writeln(item.Answer);
                        }
                    }
                }

                docBuilder.EndTable();
                docBuilder.InsertBreak(BreakType.LineBreak);
            }

            doc.Save(outputPath, SaveFormat.Pdf);

            return(File(System.IO.File.ReadAllBytes(outputPath), "application/pdf", exam.Course.CourseName + "_" + exam.Course.CourseYear.ToString()));
        }
Ejemplo n.º 38
0
 private void SetBounds()
 {
     Style.SetBounds(new Rect(Bounds.Location, (Bounds.Size - BorderThickness.Size).Max(Size.Zero)), converter);
 }
Ejemplo n.º 39
0
 public async Task Create(Style style)
 {
     _db.Styles.Add(style);
     await _db.SaveChangesAsync();
 }
Ejemplo n.º 40
0
 private void SetIsHitTestVisible()
 {
     Style.SetIsHitTestVisible(IsHitTestVisible && Background != null);
 }
Ejemplo n.º 41
0
 /// <summary>Constructor</summary>
 /// <param name="style">The shape of the blend curve.</param>
 /// <param name="time">The duration (in seconds) of the blend</param>
 public CinemachineBlendDefinition(Style style, float time)
 {
     m_Style = style;
     m_Time = time;
 }
Ejemplo n.º 42
0
 private void SetBorderBrush()
 {
     Style.SetBorderBrush(BorderBrush, Bounds.Size, converter);
 }
Ejemplo n.º 43
0
        private static void CreateCellsFormatting(Workbook workbook)
        {
            //Define a style object adding a new style
            //to the collection list.
            Style stl0 = workbook.Styles[workbook.Styles.Add()];

            //Set a custom shading color of the cells.
            stl0.ForegroundColor = Color.FromArgb(155, 204, 255);
            //Set the solid background fillment.
            stl0.Pattern = BackgroundType.Solid;
            //Set a font.
            stl0.Font.Name = "Trebuchet MS";
            //Set the size.
            stl0.Font.Size = 18;
            //Set the font text color.
            stl0.Font.Color = Color.Maroon;
            //Set it bold
            stl0.Font.IsBold = true;
            //Set it italic.
            stl0.Font.IsItalic = true;
            //Define a style flag struct.
            StyleFlag flag = new StyleFlag();

            //Apply cell shading.
            flag.CellShading = true;
            //Apply font.
            flag.FontName = true;
            //Apply font size.
            flag.FontSize = true;
            //Apply font color.
            flag.FontColor = true;
            //Apply bold font.
            flag.FontBold = true;
            //Apply italic attribute.
            flag.FontItalic = true;
            //Get the first row in the first worksheet.
            Row row = workbook.Worksheets[0].Cells.Rows[0];

            //Apply the style to it.
            row.ApplyStyle(stl0, flag);

            //Obtain the cells of the first worksheet.
            Cells cells = workbook.Worksheets[0].Cells;

            //Set the height of the first row.
            cells.SetRowHeight(0, 30);

            //Define a style object adding a new style
            //to the collection list.
            Style stl1 = workbook.Styles[workbook.Styles.Add()];

            //Set the rotation angle of the text.
            stl1.RotationAngle = 45;
            //Set the custom fill color of the cells.
            stl1.ForegroundColor = Color.FromArgb(0, 51, 105);
            //Set the solid background pattern for fillment.
            stl1.Pattern = BackgroundType.Solid;
            //Set the left border line style.
            stl1.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin;
            //Set the left border line color.
            stl1.Borders[BorderType.LeftBorder].Color = Color.White;
            //Set the horizontal alignment to center aligned.
            stl1.HorizontalAlignment = TextAlignmentType.Center;
            //Set the vertical alignment to center aligned.
            stl1.VerticalAlignment = TextAlignmentType.Center;
            //Set the font.
            stl1.Font.Name = "Times New Roman";
            //Set the font size.
            stl1.Font.Size = 10;
            //Set the font color.
            stl1.Font.Color = Color.White;
            //Set the bold attribute.
            stl1.Font.IsBold = true;
            //Set the style flag struct.
            flag = new StyleFlag();
            //Apply the left border.
            flag.LeftBorder = true;
            //Apply text rotation orientation.
            flag.Rotation = true;
            //Apply fill color of cells.
            flag.CellShading = true;
            //Apply horizontal alignment.
            flag.HorizontalAlignment = true;
            //Apply vertical alignment.
            flag.VerticalAlignment = true;
            //Apply the font.
            flag.FontName = true;
            //Apply the font size.
            flag.FontSize = true;
            //Apply the font color.
            flag.FontColor = true;
            //Apply the bold attribute.
            flag.FontBold = true;
            //Get the second row of the first worksheet.
            row = workbook.Worksheets[0].Cells.Rows[1];
            //Apply the style to it.
            row.ApplyStyle(stl1, flag);

            //Set the height of the second row.
            cells.SetRowHeight(1, 48);

            //Define a style object adding a new style
            //to the collection list.
            Style stl2 = workbook.Styles[workbook.Styles.Add()];

            //Set the custom cell shading color.
            stl2.ForegroundColor = Color.FromArgb(155, 204, 255);
            //Set the solid background pattern for fillment color.
            stl2.Pattern = BackgroundType.Solid;
            //Set the font.
            stl2.Font.Name = "Trebuchet MS";
            //Set the font color.
            stl2.Font.Color = Color.Maroon;
            //Set the font size.
            stl2.Font.Size = 10;
            //Set the style flag struct.
            flag = new StyleFlag();
            //Apply cell shading.
            flag.CellShading = true;
            //Apply the font.
            flag.FontName = true;
            //Apply the font color.
            flag.FontColor = true;
            //Apply the font size.
            flag.FontSize = true;
            //Get the first column in the first worksheet.
            Column col = workbook.Worksheets[0].Cells.Columns[0];

            //Apply the style to it.
            col.ApplyStyle(stl2, flag);

            //Define a style object adding a new style
            //to the collection list.
            Style stl3 = workbook.Styles[workbook.Styles.Add()];

            //Set the custom cell filling color.
            stl3.ForegroundColor = Color.FromArgb(124, 199, 72);
            //Set the solid background pattern for fillment color.
            stl3.Pattern = BackgroundType.Solid;
            //Apply the style to A2 cell.
            cells["A2"].SetStyle(stl3);

            //Define a style object adding a new style
            //to the collection list.
            Style stl4 = workbook.Styles[workbook.Styles.Add()];

            //Set the custom font text color.
            stl4.Font.Color = Color.FromArgb(0, 51, 105);
            //Set the bottom border line style.
            stl4.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
            //Set the bottom border line color to custom color.
            stl4.Borders[BorderType.BottomBorder].Color = Color.FromArgb(124, 199, 72);
            //Set the background fill color of the cells.
            stl4.ForegroundColor = Color.White;
            //Set the solid fillcolor pattern.
            stl4.Pattern = BackgroundType.Solid;
            //Set custom number format.
            stl4.Custom = "$#,##0.0";
            //Set a style flag struct.
            flag = new StyleFlag();
            //Apply font color.
            flag.FontColor = true;
            //Apply cell shading color.
            flag.CellShading = true;
            //Apply custom number format.
            flag.NumberFormat = true;
            //Apply bottom border.
            flag.BottomBorder = true;

            //Define a style object adding a new style
            //to the collection list.
            Style stl5 = workbook.Styles[workbook.Styles.Add()];

            //Set the bottom borde line style.
            stl5.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
            //Set the bottom border line color.
            stl5.Borders[BorderType.BottomBorder].Color = Color.FromArgb(124, 199, 72);
            //Set the custom shading color of the cells.
            stl5.ForegroundColor = Color.FromArgb(250, 250, 200);
            //Set the solid background pattern for fillment color.
            stl5.Pattern = BackgroundType.Solid;
            //Set custom number format.
            stl5.Custom = "$#,##0.0";
            //Set font text color.
            stl5.Font.Color = Color.Maroon;

            //Create a named range of cells (B3:M25)in the first worksheet.
            Range range = workbook.Worksheets[0].Cells.CreateRange("B3", "M25");

            //Name the range.
            range.Name = "MyRange";
            //Apply the style to cells in the named range.
            range.ApplyStyle(stl4, flag);

            //Apply different style to alternative rows
            //in the range.
            for (int i = 0; i <= 22; i++)
            {
                for (int j = 0; j < 12; j++)
                {
                    if (i % 2 == 0)
                    {
                        range[i, j].SetStyle(stl5);
                    }
                }
            }

            //Define a style object adding a new style
            //to the collection list.
            Style stl6 = workbook.Styles[workbook.Styles.Add()];

            //Set the custom fill color of the cells.
            stl6.ForegroundColor = Color.FromArgb(0, 51, 105);
            //Set the background pattern for fillment color.
            stl6.Pattern = BackgroundType.Solid;
            //Set the font.
            stl6.Font.Name = "Arial";
            //Set the font size.
            stl6.Font.Size = 10;
            //Set the font color
            stl6.Font.Color = Color.White;
            //Set the text bold.
            stl6.Font.IsBold = true;
            //Set the custom number format.
            stl6.Custom = "$#,##0.0";
            //Set the style flag struct.
            flag = new StyleFlag();
            //Apply cell shading.
            flag.CellShading = true;
            //Apply the arial font.
            flag.FontName = true;
            //Apply the font size.
            flag.FontSize = true;
            //Apply the font color.
            flag.FontColor = true;
            //Apply the bold attribute.
            flag.FontBold = true;
            //Apply the number format.
            flag.NumberFormat = true;
            //Get the 26th row in the first worksheet which produces totals.
            row = workbook.Worksheets[0].Cells.Rows[25];
            //Apply the style to it.
            row.ApplyStyle(stl6, flag);
            //Now apply this style to those cells (N3:N25) which
            //has productwise sales totals.
            for (int i = 2; i < 25; i++)
            {
                cells[i, 13].SetStyle(stl6);
            }
            //Set N column's width to fit the contents.
            workbook.Worksheets[0].Cells.SetColumnWidth(13, 9.33);
        }
 /// <summary>
 /// Initializes a new instance of the StyleDispensedEventArgs class.
 /// </summary>
 /// <param name="index">The index of the style dispensed.</param>
 /// <param name="style">The style dispensed.</param>
 public StyleDispensedEventArgs(int index, Style style)
 {
     this.Style = style;
     this.Index = index;
 }
Ejemplo n.º 45
0
        void ResultTextDataFunc(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            if (TreeIter.Zero.Equals(iter))
            {
                return;
            }
            CellRendererText textRenderer = (CellRendererText)cell;
            SearchResult     searchResult = (SearchResult)store.GetValue(iter, SearchResultColumn);

            if (searchResult == null)
            {
                return;
            }

            Mono.TextEditor.Document doc = GetDocument(searchResult);
            int         lineNr           = doc.OffsetToLineNumber(searchResult.Offset);
            LineSegment line             = doc.GetLine(lineNr);
            bool        isSelected       = treeviewSearchResults.Selection.IterIsSelected(iter);

            string markup;

            if (doc.SyntaxMode != null)
            {
                markup = doc.SyntaxMode.GetMarkup(doc, new TextEditorOptions(), highlightStyle, line.Offset, line.EditableLength, true, !isSelected, false);
            }
            else
            {
                markup = GLib.Markup.EscapeText(doc.GetTextAt(line.Offset, line.EditableLength));
            }

            if (!isSelected)
            {
                int    col = searchResult.Offset - line.Offset;
                string tag;
                int    pos1 = FindPosition(markup, col, out tag);
                int    pos2 = FindPosition(markup, col + searchResult.Length, out tag);
                if (pos1 >= 0 && pos2 >= 0)
                {
                    if (tag.StartsWith("span"))
                    {
                        markup = markup.Insert(pos2, "</span></span><" + tag + ">");
                    }
                    else
                    {
                        markup = markup.Insert(pos2, "</span>");
                    }
                    Gdk.Color searchColor = highlightStyle.SearchTextBg;
                    double    b1          = HslColor.Brightness(searchColor);
                    double    b2          = HslColor.Brightness(AdjustColor(Style.Base(StateType.Normal), highlightStyle.Default.Color));
                    double    delta       = Math.Abs(b1 - b2);
                    if (delta < 0.1)
                    {
                        HslColor color1 = highlightStyle.SearchTextBg;
                        if (color1.L + 0.5 > 1.0)
                        {
                            color1.L -= 0.5;
                        }
                        else
                        {
                            color1.L += 0.5;
                        }
                        searchColor = color1;
                    }
                    markup = markup.Insert(pos1, "<span background=\"" + SyntaxMode.ColorToPangoMarkup(searchColor) + "\">");
                }
            }
            string markupText = AdjustColors(markup.Replace("\t", new string (' ', TextEditorOptions.DefaultOptions.TabSize)));

            try {
                textRenderer.Markup = markupText;
            } catch (Exception e) {
                LoggingService.LogError("Error whil setting the text renderer markup to: " + markup, e);
            }
        }
Ejemplo n.º 46
0
        public MainWindow()
        {
            DateTime dstart = DateTime.Now;

            InitializeComponent();

            CommandArgs.AddRange(Environment.GetCommandLineArgs());
            CommandArgs.RemoveAt(0);

            //Disbale SSL/TLS Errors
            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            //Disable CRL Check
            System.Net.ServicePointManager.CheckCertificateRevocationList = false;
            //Get Proxy from IE
            WebRequest.DefaultWebProxy = WebRequest.GetSystemWebProxy();

            if (Properties.Settings.Default.UpgradeSettings)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeSettings = false;
                Properties.Settings.Default.Save();
            }

            tbSVC.Text = Properties.Settings.Default.WebService;

            //Get Version
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);

            tbVersion.Text   = string.Format(tbVersion.Text, fvi.FileVersion);
            lVersion.Content = "Version: " + fvi.FileVersion;

            //Hide Tabs
            Style s = new Style();

            s.Setters.Add(new Setter(UIElement.VisibilityProperty, Visibility.Collapsed));
            tabWizard.ItemContainerStyle = s;

            if (string.IsNullOrEmpty(Properties.Settings.Default.UserKey))
            {
                Properties.Settings.Default.UserKey = Guid.NewGuid().ToString();
                Properties.Settings.Default.Save();
            }

            //RZRestAPI.sURL = Properties.Settings.Default.WebService;
            RZRestAPI.DisableBroadcast = Properties.Settings.Default.DisableBroadcast;
            tbSVC.Text          = RZRestAPI.sURL;
            tbIPFSGW.Text       = Properties.Settings.Default.IPFSGW;
            cbRZCache.IsChecked = !Properties.Settings.Default.DisableBroadcast;

            //Authenticate;
            Authenticate();
            //ReAuthenticate every 20min
            tReAuth.Interval  = 1200000;
            tReAuth.Elapsed  += TReAuth_Elapsed;
            tReAuth.Enabled   = true;
            tReAuth.AutoReset = true;

            tReAuth.Start();

            //Set SOAP Header
            //oAPI.SecuredWebServiceHeaderValue = new RZApi.SecuredWebServiceHeader() { AuthenticatedToken = sAuthToken };

            oInstPanel.sAuthToken = sAuthToken;
            oInstPanel.onEdit    += oInstPanel_onEdit;
            oUpdPanel.onEdit     += oInstPanel_onEdit;
            //oInstPanel.OnSWUpdated += OUpdPanel_OnSWUpdated;
            oUpdPanel.OnSWUpdated += OUpdPanel_OnSWUpdated;

            double dSeconds = (DateTime.Now - dstart).TotalSeconds;

            dSeconds.ToString();


            //Run PowerShell check in separate thread...
            Thread thread = new Thread(() =>
            {
                try
                {
                    Runspace runspace = RunspaceFactory.CreateRunspace();
                    runspace.Open();

                    PowerShell powershell = PowerShell.Create();
                    powershell.AddScript("(get-Host).Version");
                    powershell.Runspace           = runspace;
                    Collection <PSObject> results = powershell.Invoke();
                    if (((System.Version)(results[0].BaseObject)).Major < 4)
                    {
                        if (MessageBox.Show("The current Version of PowerShell is not supported. Do you want to update ?", "Update Powershell", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes) == MessageBoxResult.Yes)
                        {
                            //Update...
                            Process.Start("https://www.microsoft.com/en-us/download/details.aspx?id=50395");
                            this.Close();
                        }
                    }
                }
                catch { }
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            FileVersionInfo FI = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);

            oSCAN = new RZScan(false, true);

            oSCAN.StaticInstalledSoftware.Add(new AddSoftware()
            {
                ProductName = "RuckZuck", Manufacturer = FI.CompanyName, ProductVersion = FI.ProductVersion.ToString()
            });
            oSCAN.OnSWScanCompleted  += OSCAN_OnSWScanCompleted;
            oSCAN.OnUpdatesDetected  += OSCAN_OnUpdatesDetected;
            oSCAN.OnSWRepoLoaded     += OSCAN_OnSWRepoLoaded;
            oSCAN.OnUpdScanCompleted += OSCAN_OnUpdScanCompleted;
            oSCAN.OnInstalledSWAdded += OSCAN_OnInstalledSWAdded;
            oSCAN.bCheckUpdates       = true;

            oSCAN.GetSWRepository().ConfigureAwait(false);

            //oSCAN.tRegCheck.Start();

            if (CommandArgs.Count > 0)
            {
                oInstPanel.EnableFeedback = false;
                oInstPanel.EnableEdit     = false;
                oInstPanel.EnableSupport  = false;
            }
            else
            {
                //Skip Startpage for registerred users...
                if (tbURL.IsEnabled)
                {
                    tabWizard.SelectedItem = tabMain;
                    oSCAN.SWScan();

                    oInstPanel.EnableFeedback = true;
                    oInstPanel.EnableEdit     = true;
                    oInstPanel.EnableSupport  = true;
                }
                else
                {
                    oInstPanel.EnableSupport = false;
                    oSCAN.SWScan();
                }
            }
        }
Ejemplo n.º 47
0
 protected override int GetRoundingSize(Style style)
 {
     return(style.InterfaceRoundingSize);
 }
Ejemplo n.º 48
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HelpBlock"/> class.
        /// </summary>
        public HelpBlock()
        {
            var style = new Style();

            this.Style = style.GetStyleAttributes(this);
        }
Ejemplo n.º 49
0
 protected override bool IsBorderDashed(Style style)
 {
     return(style.IsInterfaceBorderDashed);
 }
Ejemplo n.º 50
0
 protected override GradientStyle GetGradientHeaderStyle(Style style)
 {
     return(style.InterfaceGradientHeaderStyle);
 }
Ejemplo n.º 51
0
 protected override Color GetBackgroundColor(Style style)
 {
     return(style.InterfaceBackgroundColor);
 }
Ejemplo n.º 52
0
 protected override Color GetHeaderColor(Style style)
 {
     return(style.InterfaceHeaderColor);
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Sets the style property of an element.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <param name="style">The style.</param>
 public static void SetStyle(this FrameworkElement element, Style style)
 {
     element.Style = style;
 }
Ejemplo n.º 54
0
 protected override int GetBorderWidth(Style style)
 {
     return(style.InterfaceBorderWidth);
 }
        private void InitializeBars()
        {
            IAudioPlayerAnalyze player = ActiveSpectrumPlayer;

            if (player == null)
            {
                _barWidth = 1;
                _maximumFrequencyIndex = -1;
                _minimumFrequencyIndex = 0;
                return;
            }

            if (!_refreshShapes || _spectrumCanvas == null)
            {
                return;
            }

            int  maxIndex;
            int  minIndex;
            bool res = player.GetFFTFrequencyIndex(MaximumFrequency, out maxIndex);

            res |= player.GetFFTFrequencyIndex(MinimumFrequency, out minIndex);
            if (!res)
            {
                return;
            }
            _maximumFrequencyIndex = Math.Min(maxIndex + 1, FREQUENCY_BUFFER_SIZE - 1);
            _minimumFrequencyIndex = Math.Min(minIndex, FREQUENCY_BUFFER_SIZE - 1);

            _barWidth = Math.Max(((_spectrumCanvas.ActualWidth - (BarSpacing * (BarCount + 1))) / BarCount), 1);
            int actualBarCount = _barWidth >= 1.0d ? BarCount : Math.Max((int)((_spectrumCanvas.ActualWidth - BarSpacing) / (_barWidth + BarSpacing)), 1);

            _channelPeakData = new float[actualBarCount];

            int        indexCount            = _maximumFrequencyIndex - _minimumFrequencyIndex;
            int        linearIndexBucketSize = (int)Math.Round(indexCount / (double)actualBarCount, 0);
            List <int> maxIndexList          = new List <int>();
            List <int> maxLogScaleIndexList  = new List <int>();
            double     maxLog = Math.Log(actualBarCount, actualBarCount);

            for (int i = 1; i < actualBarCount; i++)
            {
                maxIndexList.Add(_minimumFrequencyIndex + (i * linearIndexBucketSize));
                int logIndex = (int)((maxLog - Math.Log((actualBarCount + 1) - i, (actualBarCount + 1))) * indexCount) + _minimumFrequencyIndex;
                maxLogScaleIndexList.Add(logIndex);
            }
            maxIndexList.Add(_maximumFrequencyIndex);
            maxLogScaleIndexList.Add(_maximumFrequencyIndex);
            _barIndexMax         = maxIndexList.ToArray();
            _barLogScaleIndexMax = maxLogScaleIndexList.ToArray();

            FrameworkElementCollection canvasChildren = _spectrumCanvas.Children;

            canvasChildren.StartUpdate();
            try
            {
                canvasChildren.Clear();

                double height        = _spectrumCanvas.ActualHeight;
                double peakDotHeight = Math.Max(_barWidth / 2.0f, 1);
                for (int i = 0; i < actualBarCount; i++)
                {
                    // Deep copy the styles to each bar
                    Style barStyleCopy  = MpfCopyManager.DeepCopyCutLVPs(BarStyle);
                    Style peakStyleCopy = MpfCopyManager.DeepCopyCutLVPs(PeakStyle);

                    double  xCoord     = BarSpacing + (_barWidth * i) + (BarSpacing * i) + 1;
                    Control barControl = new Control
                    {
                        Width  = _barWidth,
                        Height = height,
                        Style  = barStyleCopy
                    };
                    Canvas.SetLeft(barControl, xCoord);
                    Canvas.SetBottom(barControl, height);
                    _barShapes.Add(barControl);
                    canvasChildren.Add(barControl);

                    Control peakControl = new Control
                    {
                        Width  = _barWidth,
                        Height = peakDotHeight,
                        Style  = peakStyleCopy
                    };
                    Canvas.SetLeft(peakControl, xCoord);
                    Canvas.SetBottom(peakControl, height);
                    _peakShapes.Add(peakControl);
                    canvasChildren.Add(peakControl);
                }
            }
            finally
            {
                canvasChildren.EndUpdate();
            }
            ActualBarWidth = _barWidth;
            _refreshShapes = false;
        }
Ejemplo n.º 56
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (_windowControl != null)
            {
                _windowControl.HeaderDragDelta         -= (o, e) => this.OnHeaderDragDelta(e);
                _windowControl.HeaderIconDoubleClicked -= (o, e) => this.OnHeaderIconDoubleClick(e);
                _windowControl.CloseButtonClicked      -= (o, e) => this.OnCloseButtonClicked(e);
            }
            _windowControl = this.GetTemplateChild(PART_WindowControl) as WindowControl;
            if (_windowControl != null)
            {
                _windowControl.HeaderDragDelta         += (o, e) => this.OnHeaderDragDelta(e);
                _windowControl.HeaderIconDoubleClicked += (o, e) => this.OnHeaderIconDoubleClick(e);
                _windowControl.CloseButtonClicked      += (o, e) => this.OnCloseButtonClicked(e);
            }

            this.UpdateBlockMouseInputsPanel();

            _windowRoot = this.GetTemplateChild(PART_WindowRoot) as Grid;
            if (_windowRoot != null)
            {
                _windowRoot.RenderTransform = _moveTransform;
            }
            _hasWindowContainer = (VisualTreeHelper.GetParent(this) as WindowContainer) != null;

            if (!_hasWindowContainer)
            {
                _parentContainer = VisualTreeHelper.GetParent(this) as FrameworkElement;
                if (_parentContainer != null)
                {
                    _parentContainer.LayoutUpdated += ParentContainer_LayoutUpdated;
                    _parentContainer.SizeChanged   += ParentContainer_SizeChanged;

                    //this is for XBAP applications only. When inside an XBAP the parent container has no height or width until it has loaded. Therefore
                    //we need to handle the loaded event and reposition the window.
                    if (System.Windows.Interop.BrowserInteropHelper.IsBrowserHosted)
                    {
                        _parentContainer.Loaded += (o, e) =>
                        {
                            ExecuteOpen();
                        };
                    }
                }

                this.Unloaded += new RoutedEventHandler(ChildWindow_Unloaded);

                //initialize our modal background width/height
                _modalLayer.Height = _parentContainer.ActualHeight;
                _modalLayer.Width  = _parentContainer.ActualWidth;

                _root = this.GetTemplateChild(PART_Root) as Grid;

#if VS2008
                FocusVisualStyle = null;
#else
                Style focusStyle = (_root != null) ? _root.Resources["FocusVisualStyle"] as Style : null;
                if (focusStyle != null)
                {
                    Setter focusStyleDataContext = new Setter(Control.DataContextProperty, this);
                    focusStyle.Setters.Add(focusStyleDataContext);
                    FocusVisualStyle = focusStyle;
                }
#endif
                if (_root != null)
                {
                    _root.Children.Add(_modalLayerPanel);
                }
            }
        }
Ejemplo n.º 57
0
 public override string ToString()
 {
     return("ToolBarButton: " + Text + ", Style: " + Style.ToString("G"));
 }
Ejemplo n.º 58
0
        protected override bool OnExposeEvent(Gdk.EventExpose e)
        {
            using (Cairo.Context cr = Gdk.CairoHelper.Create(e.Window)) {
                double xPos = padding, yPos = padding;
                var    layout = PangoUtil.CreateLayout(this);
                int    w, h;
                layout.SetText(new string ('X', maxLength));
                layout.GetPixelSize(out w, out h);

                foreach (Category cat in categories)
                {
                    yPos = padding;
                    cr.MoveTo(xPos, yPos);
                    layout.SetMarkup("<b>" + cat.Title + "</b>");
                    cr.SetSourceColor(Style.Text(StateType.Normal).ToCairoColor());
                    cr.ShowLayout(layout);

                    if (cat.Items.Count == 0)
                    {
                        continue;
                    }

                    layout.SetMarkup("");
                    int w2, h2;
                    layout.GetPixelSize(out w2, out h2);
                    yPos += h2;
                    yPos += headerDistance;
                    var startY     = yPos;
                    int curItem    = 0;
                    int row        = 0;
                    var iconHeight = Math.Max(h, cat.Items [0].Icon.Height + 2) + itemPadding * 2;
                    if (cat.FirstVisibleItem > 0)
                    {
                        Gtk.Style.PaintArrow(Style, e.Window, State, ShadowType.None,
                                             new Rectangle((int)xPos, (int)yPos, w, h),
                                             this,
                                             "",
                                             ArrowType.Up,
                                             true,
                                             (int)xPos,
                                             (int)yPos,
                                             w,
                                             h);
                        yPos += iconHeight;
                        curItem++;
                    }

                    for (int i = cat.FirstVisibleItem; i < cat.Items.Count; i++)
                    {
                        var item = cat.Items [i];

                        if (curItem + 1 >= maxItems && row + 1 >= maxRows && i + 1 < cat.Items.Count)
                        {
                            Gtk.Style.PaintArrow(Style, e.Window, State, ShadowType.None,
                                                 new Rectangle((int)xPos, (int)yPos, w, h),
                                                 this,
                                                 "",
                                                 ArrowType.Down,
                                                 true,
                                                 (int)xPos,
                                                 (int)yPos,
                                                 w,
                                                 h);
                            break;
                        }

                        if (item == ActiveItem)
                        {
                            int itemWidth = w + (int)item.Icon.Width + 2 + itemPadding * 2;
                            cr.Rectangle(xPos, yPos, itemWidth, iconHeight);
                            cr.LineWidth = 1;
                            cr.SetSourceColor(Style.Base(StateType.Selected).ToCairoColor());
                            cr.Fill();
                        }
                        else if (item == hoverItem)
                        {
                            int itemWidth = w + (int)item.Icon.Width + 2 + itemPadding * 2;
                            cr.Rectangle(xPos + 0.5, yPos + 0.5, itemWidth - 1, iconHeight);
                            cr.LineWidth = 1;
                            cr.SetSourceColor(Style.Base(StateType.Selected).ToCairoColor());
                            cr.Stroke();
                        }
                        cr.SetSourceColor(Style.Text(item == ActiveItem? StateType.Selected : StateType.Normal).ToCairoColor());
                        cr.MoveTo(xPos + item.Icon.Width + 2 + itemPadding, yPos + (iconHeight - h) / 2);
                        layout.SetText(Ellipsize(item.ListTitle ?? item.Title, maxLength));
                        cr.ShowLayout(layout);
                        cr.DrawImage(this, item.Icon, (int)xPos + itemPadding,
                                     (int)(yPos + (iconHeight - item.Icon.Height) / 2));
                        yPos += iconHeight;
                        if (++curItem >= maxItems)
                        {
                            curItem = 0;
                            yPos    = startY;
                            xPos   += w + cat.Items [0].Icon.Width + 2 + padding + itemPadding * 2;
                            row++;
                        }
                    }


                    xPos += w + cat.Items [0].Icon.Width + 2 + padding + itemPadding * 2;
                }
                layout.Dispose();
            }
            return(true);
        }
Ejemplo n.º 59
0
        private async Task RemoveSpacing()
        {
            using (var one = new OneNote(out var page, out var ns))
            {
                logger.StartClock();

                var elements = page.Root.Descendants(page.Namespace + "OE")
                               .Where(e =>
                                      e.Attribute("spaceBefore") != null ||
                                      e.Attribute("spaceAfter") != null ||
                                      e.Attribute("spaceBetween") != null)
                               .ToList();

                page.GetTextCursor();
                if (page.SelectionScope != SelectionScope.Empty)
                {
                    elements = elements.Where(e => e.Attribute("selected") != null).ToList();
                }

                if (elements.Count == 0)
                {
                    logger.StopClock();
                    return;
                }

                var quickStyles = page.GetQuickStyles()
                                  .Where(s => s.StyleType == StyleType.Heading);

                var customStyles = new ThemeProvider().Theme.GetStyles()
                                   .Where(e => e.StyleType == StyleType.Heading)
                                   .ToList();

                var modified = false;

                foreach (var element in elements)
                {
                    // is this a known Heading style?
                    var attr = element.Attribute("quickStyleIndex");
                    if (attr != null)
                    {
                        var index = int.Parse(attr.Value, CultureInfo.InvariantCulture);
                        if (quickStyles.Any(s => s.Index == index))
                        {
                            if (includeHeadings)
                            {
                                modified |= CleanElement(element);
                            }

                            continue;
                        }
                    }

                    // is this a custom Heading style?
                    var style = new Style(element.CollectStyleProperties(true));
                    if (customStyles.Any(s => s.Equals(style)))
                    {
                        if (includeHeadings)
                        {
                            modified |= CleanElement(element);
                        }

                        continue;
                    }

                    // normal paragraph
                    modified |= CleanElement(element);
                }

                logger.WriteTime("removed spacing, now saving...");

                if (modified)
                {
                    await one.Update(page);
                }
            }
        }
Ejemplo n.º 60
0
        readonly string _baseTypeName = string.Empty; // includes "_"
        public BrowseList(IEnumerable query, BrowsePanel browPanel)
        {
            this._colWidths  = browPanel._colWidths;
            this.Margin      = new System.Windows.Thickness(8);
            this.ItemsSource = query;
            var gridvw = new GridView();

            this.View = gridvw;
            var ienum = query.GetType().GetInterface(typeof(IEnumerable <>).FullName);

            var members = ienum.GetGenericArguments()[0].GetMembers().Where(m => m.MemberType == System.Reflection.MemberTypes.Property);

            foreach (var mbr in members)
            {
                //if (mbr.DeclaringType == typeof(EntityObject)) // if using Entity framework, filter out EntityKey, etc.
                //{
                //    continue;
                //}
                var dataType = mbr as System.Reflection.PropertyInfo;
                var colType  = dataType.PropertyType.Name;
                if (mbr.Name.StartsWith("_"))
                {
                    _baseType     = dataType.PropertyType;
                    _baseTypeName = mbr.Name;
                    continue;
                }
                GridViewColumn gridcol = null;

                if (mbr.Name.StartsWith("_x"))                           // == "Request" || mbr.Name == "Reply" || mbr.Name == "xmlData")
                {
                    var methodName = string.Format("get_{0}", mbr.Name); // like "get_Request" or "get_Response"
                    var enumerator = query.GetEnumerator();
                    var fLoopDone  = false;
                    while (!fLoopDone)
                    {
                        if (enumerator.MoveNext())
                        {
                            var currentRecord  = enumerator.Current;
                            var currentRecType = currentRecord.GetType();
                            var msgObj         = currentRecType.InvokeMember(methodName, BindingFlags.InvokeMethod, null, currentRecord, null);
                            if (msgObj != null)
                            {
                                var msgObjType      = msgObj.GetType();
                                var msgObjTypeProps = msgObjType.GetProperties();
                                foreach (var prop in msgObjTypeProps)
                                {
                                    AddAColumn(gridvw, prop.Name, mbr.Name);
                                }
                                fLoopDone = true;
                            }
                        }
                        else
                        {
                            fLoopDone = true;
                        }
                    }
                }
                else
                {
                    switch (colType)
                    {
                    case "XmlReader":
                    {
                        gridcol = new GridViewColumn();
                        var colheader = new GridViewColumnHeader()
                        {
                            Content = mbr.Name
                        };
                        gridcol.Header   = colheader;
                        colheader.Click += new RoutedEventHandler(Colheader_Click);
                        gridvw.Columns.Add(gridcol);
                    }
                    break;

                    default:
                    {
                        AddAColumn(gridvw, mbr.Name, bindingObjectName: null);
                    }
                    break;
                    }
                }
            }
            // now create a style for the items
            var style = new Style(typeof(ListViewItem));

            style.Setters.Add(new Setter(ForegroundProperty, Brushes.Blue));

            //            style.Setters.Add(new Setter(HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));

            var trig = new Trigger()
            {
                Property = IsSelectedProperty,// if Selected, use a different color
                Value    = true
            };

            trig.Setters.Add(new Setter(ForegroundProperty, Brushes.Red));
            trig.Setters.Add(new Setter(BackgroundProperty, Brushes.Cyan));
            style.Triggers.Add(trig);

            this.ItemContainerStyle = style;
            this.ContextMenu        = new ContextMenu();
            this.ContextMenu.AddMenuItem(On_CtxMenu, "_Copy", "Copy selected items to clipboard");
            this.ContextMenu.AddMenuItem(On_CtxMenu, "Export to E_xcel", "Create a temp file of selected items in CSV format. In Excel, select all data, Data->TextToColumns to invoke Wizard if needed");
            this.ContextMenu.AddMenuItem(On_CtxMenu, "Export to _Notepad", "Create a temp file of selected items in TXT format");
        }