예제 #1
0
        public async Task LoadObjects(MainWindow main, Settings config)
        {
            main.Cards.Children.Clear();
            main.Objects.Clear();
            var a = new SaveSystem().Load();

            main.Objects = a;
            if (a.Count == 0)
            {
                var Create = new MainObjectCreator(config, main);
                Create.ShowDialog();
            }
            foreach (var car in a)
            {
                await new MainWindowViewModel().CreateButton(main, config, car);
            }
            //if(config.LastOpen==null || config.LastOpen> main.Cards.Children.Count)
            //{
            //    main.Cards.Children[0].RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
            //}
            //else if (main.Cards.Children.Count - 1 >= config.LastOpen)
            //{
            //    main.Cards.Children[config.LastOpen].RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
            //}
        }
예제 #2
0
        public void AddC(object sender, RoutedEventArgs e)
        {
            var create = new MainObjectCreator(Config, this);

            create.ShowDialog();
            new MainWindowViewModel().LoadObjects(this, Config);
        }