Inheritance: System.Windows.Controls.UserControl
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.metroOpenFile = ((XapEditor.controls.MetroTile)(target));
                return;

            case 2:
                this.metroOpenXap = ((XapEditor.controls.MetroTile)(target));
                return;

            case 3:
                this.metroDonate = ((XapEditor.controls.MetroTile)(target));
                return;

            case 4:
                this.metro_menu_recent = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 5:
                this.metro_menu_recentxap = ((System.Windows.Controls.StackPanel)(target));
                return;
            }
            this._contentLoaded = true;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.metroOpenFile = ((XapEditor.controls.MetroTile)(target));
     return;
     case 2:
     this.metroOpenXap = ((XapEditor.controls.MetroTile)(target));
     return;
     case 3:
     this.metroDonate = ((XapEditor.controls.MetroTile)(target));
     return;
     case 4:
     this.metro_menu_recent = ((System.Windows.Controls.StackPanel)(target));
     return;
     case 5:
     this.metro_menu_recentxap = ((System.Windows.Controls.StackPanel)(target));
     return;
     }
     this._contentLoaded = true;
 }
        void LoadRecent(string storage, string menuitem)
        {
            string     ss   = Storage.Load(storage);
            MenuItem   menu = (FindName(menuitem) as MenuItem);
            StackPanel mm   = null;

            if (filez.Items.Count > 0)
            {
                mm = ((filez.Items[0] as TabItem).Content as XapEditor.controls.Startpage).FindName(string.Format("metro_{0}", menuitem)) as StackPanel;
                mm.Children.Clear();
            }
            menu.Items.Clear();
            menu.IsEnabled = false;
            if (ss.Length > 0)
            {
                List <string> lst = new List <string>(ss.Split('|'));
                if (lst.Count > 0)
                {
                    for (int a = lst.Count - 1; a >= 0; a--)
                    {
                        MenuItem mi = new MenuItem()
                        {
                            Header = Path.GetFileName(lst[a]), ToolTip = lst[a], Tag = lst[a]
                        };
                        mi.Click    += delegate(object se, RoutedEventArgs e) { OpenFile((se as MenuItem).Tag.ToString()); };
                        mi.IsEnabled = System.IO.File.Exists(lst[a]);
                        menu.Items.Add(mi);
                        bool isx = menuitem.Contains("xap");
                        XapEditor.controls.MetroTile mt = new controls.MetroTile()
                        {
                            Icon = (isx ? "box" : "file"), Text = mi.Header.ToString(), Tag = mi.Tag
                        };
                        mt.BackgroundBrush = new SolidColorBrush(!isx ? Color.FromArgb(102, 100, 140, 255) : Color.FromArgb(102, 190, 255, 20));
                        mt.txt.FontSize    = 18;
                        mt.Click          += delegate(object s, RoutedEventArgs e) { OpenFile((s as XapEditor.controls.MetroTile).Tag.ToString()); };
                        if (mm != null)
                        {
                            mm.Children.Add(mt);
                        }
                    }
                    MenuItem ci = new MenuItem()
                    {
                        Header = "Clear List",
                        Tag    = menuitem,
                        Icon   = new System.Windows.Controls.Image {
                            Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("icons/icon_del.png", UriKind.Relative))
                        }
                    };
                    ci.Click += delegate(object se, RoutedEventArgs ev)
                    {
                        Storage.Save(storage, string.Empty);
                        LoadRecent(storage, (se as MenuItem).Tag.ToString());
                    };
                    menu.Items.Add(new Separator());
                    menu.Items.Add(ci);
                    menu.IsEnabled = true;
                }
            }
            else
            {
                if (mm != null)
                {
                    mm.Children.Add(new TextBlock()
                    {
                        Text = "The list is empty", FontStyle = FontStyles.Italic, Margin = new Thickness(4, 0, 4, 0), Foreground = new SolidColorBrush(Color.FromArgb(102, 0, 0, 0))
                    });
                }
            }
        }
 void LoadRecent(string storage, string menuitem)
 {
     string ss = Storage.Load(storage);
     MenuItem menu = (FindName(menuitem) as MenuItem);
     StackPanel mm = null;
     if (filez.Items.Count > 0)
     {
         mm = ((filez.Items[0] as TabItem).Content as XapEditor.controls.Startpage).FindName(string.Format("metro_{0}", menuitem)) as StackPanel;
         mm.Children.Clear();
     }
     menu.Items.Clear();
     menu.IsEnabled = false;
     if (ss.Length > 0)
     {
         List<string> lst = new List<string>(ss.Split('|'));
         if (lst.Count > 0)
         {
             for (int a = lst.Count - 1; a >= 0; a--)
             {
                 MenuItem mi = new MenuItem() { Header = Path.GetFileName(lst[a]), ToolTip = lst[a], Tag = lst[a] };
                 mi.Click += delegate(object se, RoutedEventArgs e) { OpenFile((se as MenuItem).Tag.ToString()); };
                 mi.IsEnabled = System.IO.File.Exists(lst[a]);
                 menu.Items.Add(mi);
                 bool isx = menuitem.Contains("xap");
                 XapEditor.controls.MetroTile mt = new controls.MetroTile() { Icon = (isx ? "box" : "file"), Text = mi.Header.ToString(), Tag = mi.Tag };
                 mt.BackgroundBrush = new SolidColorBrush(!isx ? Color.FromArgb(102, 100, 140, 255) : Color.FromArgb(102, 190, 255, 20));
                 mt.txt.FontSize = 18;
                 mt.Click += delegate(object s, RoutedEventArgs e) { OpenFile((s as XapEditor.controls.MetroTile).Tag.ToString()); };
                 if (mm != null) mm.Children.Add(mt);
             }
             MenuItem ci = new MenuItem()
             {
                 Header = "Clear List",
                 Tag = menuitem,
                 Icon = new System.Windows.Controls.Image { Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("icons/icon_del.png", UriKind.Relative)) }
             };
             ci.Click += delegate(object se, RoutedEventArgs ev)
             {
                 Storage.Save(storage, string.Empty);
                 LoadRecent(storage, (se as MenuItem).Tag.ToString());
             };
             menu.Items.Add(new Separator());
             menu.Items.Add(ci);
             menu.IsEnabled = true;
         }
     }
     else
     {
         if (mm != null) mm.Children.Add(new TextBlock() { Text = "The list is empty", FontStyle = FontStyles.Italic, Margin = new Thickness(4, 0, 4, 0), Foreground = new SolidColorBrush(Color.FromArgb(102, 0, 0, 0)) });
     }
 }