Exemplo n.º 1
0
        private void ChbShowSplitLine_CheckChanged(object sender, RoutedEventArgs e)
        {
            if (!IsLoaded)
            {
                return;
            }

            GroupBoxHelper.SetIsSplitLineVisible(GrpCustom, ChbShowSplitLine.IsChecked == true);

            UpdateCode();
        }
Exemplo n.º 2
0
 private void UpdateVisualEffect()
 {
     switch (Helper.Tier)
     {
     case 1:
     case 2:
         AnimationHelper.SetSlideInFromBottom(GrpPalette, true);
         RectBackground.Fill = FindResource("GridBrush") as Brush;
         GroupBoxHelper.SetShadowColor(GrpPalette, Colors.LightGray);
         break;
     }
 }
Exemplo n.º 3
0
        private void ChbShowIcon_CheckChanged(object sender, RoutedEventArgs e)
        {
            if (!IsLoaded)
            {
                return;
            }

            GroupBoxHelper.SetIcon(GrpCustom, ChbShowIcon.IsChecked == true ? "\uf11c" : null);

            UpdateTemplate();
            UpdateCode();
        }
Exemplo n.º 4
0
 private void UpdateVisualEffect()
 {
     switch (Helper.Tier)
     {
     case 1:
     case 2:
         AnimationHelper.SetSlideInFromBottom(GrpPalette, true);
         RectBackground.Fill = FindResource("GridBrush") as Brush;
         GroupBoxHelper.SetEffect(GrpPalette, FindResource("DropShadow") as Effect);
         GroupBoxHelper.SetEffect(GrpCode, FindResource("DropShadow") as Effect);
         break;
     }
 }
Exemplo n.º 5
0
        private void UpdateTemplate()
        {
            if (GroupBoxHelper.GetIcon(GrpCustom) == null)
            {
                GroupBoxHelper.SetHeaderPadding(GrpCustom, new Thickness(5, SldHeaderPadding.Value, 0, SldHeaderPadding.Value));
            }
            else
            {
                GroupBoxHelper.SetHeaderPadding(GrpCustom, new Thickness(0, SldHeaderPadding.Value, 0, SldHeaderPadding.Value));
            }

            GroupBoxHelper.SetCornerRadius(GrpCustom, new CornerRadius(SldCornerRadius.Value));
        }
Exemplo n.º 6
0
        private void UpdateCode()
        {
            var icon          = GroupBoxHelper.GetIcon(GrpCustom);
            var cornerRadius  = SldCornerRadius.Value;
            var headerPadding = SldHeaderPadding.Value;
            var splitLine     = GroupBoxHelper.GetIsSplitLineVisible(GrpCustom);
            var shadow        = GroupBoxHelper.GetShadowColor(GrpCustom);

            TbCode.Text = $"<GroupBox Width=\"{GrpCustom.Width}\"" +
                          $"\nHeader=\"{GrpCustom.Header}\"" +
                          $"\nVerticalAlignment=\"Center\"" +
                          $"\nHorizontalAlignment=\"Center\"" +
                          (icon == null ? "" : $"\npu:GroupBoxHelper.Icon=\"&#xf11c;\"") +
                          (cornerRadius == 0 ? "" : $"\npu:GroupBoxHelper.CornerRadius=\"{cornerRadius}\"") +
                          (headerPadding == 5 ? "" : $"\npu:GroupBoxHelper.HeaderPadding=\"{GroupBoxHelper.GetHeaderPadding(GrpCustom)}\"") +
                          (splitLine ? $"\npu:GroupBoxHelper.IsSplitLineVisible=\"True\"" : "") +
                          (shadow == null ? "" : $"\npu:GroupBoxHelper.ShadowColor=\"LightGray\"") +
                          " />";
        }
Exemplo n.º 7
0
 private void ChbExtendControl_CheckChanged(object sender, RoutedEventArgs e)
 {
     if (ChbExtendControl.IsChecked != true)
     {
         GroupBoxHelper.SetExtendControl(GrpCustom, null);
     }
     else
     {
         var button = new Button()
         {
             Content    = "details >",
             Margin     = new Thickness(0, 0, 5, 0),
             Foreground = "#AA57A2E0".ToColor().ToBrush()
         };
         ButtonHelper.SetButtonStyle(button, ButtonStyle.Link);
         ButtonHelper.SetHoverBrush(button, "#57A2E0".ToColor().ToBrush());
         GroupBoxHelper.SetExtendControl(GrpCustom, button);
     }
 }
Exemplo n.º 8
0
        public MainWindow()
        {
            SplashScreen splash = new SplashScreen("images/SplashScreen.png");

            splash.Show(true, true);
            //load configuration
            NameValueCollection             cfg           = ConfigurationManager.AppSettings;
            Configuration                   configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            KeyValueConfigurationCollection c             = configuration.AppSettings.Settings;
            List <string>                   list          = new List <string>(); list.AddRange(c.AllKeys);

            if (!list.Contains("Height"))
            {
                c.Add(new KeyValueConfigurationElement("Height", "720"));
            }
            if (!list.Contains("Width"))
            {
                c.Add(new KeyValueConfigurationElement("Width", "1280"));
            }
            if (!list.Contains("Account"))
            {
                c.Add(new KeyValueConfigurationElement("Account", "Steve"));
            }
            if (!list.Contains("Memory"))
            {
                c.Add(new KeyValueConfigurationElement("Memory", "1024"));
            }
            if (!list.Contains("JavaPath"))
            {
                c.Add(new KeyValueConfigurationElement("JavaPath", ""));
            }
            if (!list.Contains("MCPath"))
            {
                c.Add(new KeyValueConfigurationElement("MCPath", ""));
            }
            if (!list.Contains("DataShare"))
            {
                c.Add(new KeyValueConfigurationElement("DataShare", "true"));
            }
            if (!list.Contains("Online"))
            {
                c.Add(new KeyValueConfigurationElement("Online", "true"));
            }
            if (!list.Contains("FirstRun"))
            {
                c.Add(new KeyValueConfigurationElement("FirstRun", "true"));
            }
            configuration.Save();
            ConfigurationManager.RefreshSection("appSettings");
            Config.UpdateSettings();
            //initialize UI
            InitializeComponent();
            DataContext = this;
            (About.Content as About).ver.Content = "Version: 3.0";
            //load plugins
            if (!Directory.Exists(Environment.CurrentDirectory + "\\plugins"))
            {
                Directory.CreateDirectory(Environment.CurrentDirectory + "\\plugins");
            }
            foreach (string file in Directory.GetFiles(Environment.CurrentDirectory + "\\plugins"))
            {
                if (file.Substring(file.Length - 3) != "dll")
                {
                    continue;
                }
                Assembly asm = Assembly.LoadFile(file);
                Type[]   t   = asm.GetExportedTypes();
                foreach (Type type in t)
                {
                    if (type.BaseType == typeof(MtbPlugin))
                    {
                        MtbPlugin plugin = (MtbPlugin)Activator.CreateInstance(type);
                        plugin.LoadPlugin();
                        if (plugin.CheckUpdate())
                        {
                            Console.WriteLine(plugin.Name + ":" + plugin.UpdateMessage);
                        }

                        foreach (KeyValuePair <string, Tile[]> item in plugin.GetPages())
                        {
                            WrapPanel wp = new WrapPanel {
                                Orientation = Orientation.Vertical, Height = 252
                            };
                            foreach (Tile page in item.Value)
                            {
                                page.Height     = page.Width = 120;
                                page.Background = tileBrush;
                                wp.Children.Add(page);
                            }
                            GroupBox grop = new GroupBox
                            {
                                Header              = item.Key,
                                Content             = wp,
                                Margin              = new Thickness(5, 5, 10, 10),
                                HorizontalAlignment = HorizontalAlignment.Left,
                                Background          = Brushes.Transparent,
                                BorderBrush         = groupBrush
                            };
                            ControlsHelper.SetHeaderFontSize(grop, 14);
                            GroupBoxHelper.SetHeaderForeground(grop, Brushes.White);
                            panel.Children.Add(grop);
                        }
                        tasks.Children.Add(new TaskBarButton {
                            Tip = plugin.Name, Source = plugin.Icon, Plugin = plugin
                        });
                    }
                }
            }
            Task.Run(new Action(CheckUpdate));
        }
Exemplo n.º 9
0
 private void ChbShowShadow_CheckChanged(object sender, RoutedEventArgs e)
 {
     GroupBoxHelper.SetShadowColor(GrpCustom, ChbShowShadow.IsChecked == true ? Colors.LightGray : (Color?)null);
 }