代码拉取完成,页面将自动刷新
/*
* Description:MainWindowViewModel
* Author: Chance.Zheng
* Create Time: 2023/2/15 17:10:29
* .Net Version: 4.8
* CLR Version: 4.0.30319.42000
* Copyright (c) Chance 2021 All Rights Reserved.
*/
using CookPopularToolkit;
using Prism.Commands;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using PropertyChanged;
using System.Configuration;
using Prism.Ioc;
using System.Windows.Controls;
using Unity;
namespace CookPopularInstaller.Generate.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
public int ContentViewSelectedIndex { get; set; } = -1;
public object ContentView
{
get
{
if (ContentViewSelectedIndex >= 0)
{
//var type = Type.GetType($"CookPopularInstaller.Generate.Views.{ViewNames.ElementAt(ContentViewSelectedIndex)}View");
//return App.Container.Resolve(type);
var viewName = $"{ViewNames.ElementAt(ContentViewSelectedIndex)}View";
return App.Container.Resolve<UserControl>(viewName);
}
else
{
return App.Container.Resolve<Views.MainView>();
}
}
}
public ObservableCollection<string> ContentViewsList { get; set; }
public bool IsBeginGenerate { get; set; }
public DelegateCommand BeginCommand => new Lazy<DelegateCommand>(() => new DelegateCommand(OnBeginAction)).Value;
//public DelegateCommand HomeCommand => new Lazy<DelegateCommand>(() => new DelegateCommand(()=> IsBeginGenerate = false)).Value;
public DelegateCommand ClosingCommand => new Lazy<DelegateCommand>(() => new DelegateCommand(OnClosingAction)).Value;
private static readonly IList<string> ViewNames = new List<string>() { "Project", "Confuse", "Depends", "Extensions", "Build" };
public MainWindowViewModel()
{
ContentViewsList = new ObservableCollection<string>();
ViewNames.ForEach(viewName => ContentViewsList.Add(viewName));
}
private void OnBeginAction()
{
IsBeginGenerate = true;
ContentViewSelectedIndex = 0;
}
private void OnClosingAction()
{
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。