Ejemplo n.º 1
0
        private void LoadLaunchables()
        {
            int maxCount = 0;

            if (LauncherSettings.Default.Apps.Count > maxCount)
            {
                maxCount = LauncherSettings.Default.Apps.Count;
            }
            if (LauncherSettings.Default.Args.Count > maxCount)
            {
                maxCount = LauncherSettings.Default.Args.Count;
            }
            if (LauncherSettings.Default.Labels.Count > maxCount)
            {
                maxCount = LauncherSettings.Default.Labels.Count;
            }
            if (LauncherSettings.Default.Icons.Count > maxCount)
            {
                maxCount = LauncherSettings.Default.Icons.Count;
            }

            for (int i = 0; i < maxCount; i++)
            {
                Launchable newButton = new Launchable();
                newButton.app   = LauncherSettings.Default.Apps[i];
                newButton.args  = LauncherSettings.Default.Args[i];
                newButton.label = LauncherSettings.Default.Labels[i];
                newButton.icon  = LauncherSettings.Default.Icons[i];
                _launchables.Add(newButton);
            }
        }
Ejemplo n.º 2
0
        private void CreateButtons()
        {
            for (int i = 0; i < _launchables.Count; i++)
            {
                Launchable curButton = _launchables[i];

                Button MyControl = new Button();
                MyControl.Content = curButton.label;
                MyControl.Click  += new RoutedEventHandler(this.button_Click);
                MyControl.Tag     = i;

                Grid.SetRow(MyControl, _launchables.IndexOf(curButton));
                Grid.SetColumn(MyControl, 0);
                gridMain.Children.Add(MyControl);
            }
        }