|
@@ -0,0 +1,188 @@
|
|
|
|
+using PDF_Office.Model;
|
|
|
|
+using PDF_Office.Model.Dialog;
|
|
|
|
+using Prism.Commands;
|
|
|
|
+using Prism.Mvvm;
|
|
|
|
+using Prism.Services.Dialogs;
|
|
|
|
+using System;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+using System.Collections.ObjectModel;
|
|
|
|
+using System.Linq;
|
|
|
|
+using System.Text;
|
|
|
|
+using System.Threading.Tasks;
|
|
|
|
+using System.Windows;
|
|
|
|
+
|
|
|
|
+namespace PDF_Office.ViewModels.Dialog
|
|
|
|
+{
|
|
|
|
+ public class NoviceGuidDialogViewModel :BindableBase,IDialogAware
|
|
|
|
+ {
|
|
|
|
+ public string Title => "";
|
|
|
|
+
|
|
|
|
+ public event Action<IDialogResult> RequestClose;
|
|
|
|
+
|
|
|
|
+ private int selectedIndex;
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 选中索引
|
|
|
|
+ /// </summary>
|
|
|
|
+ public int SelectedIndex
|
|
|
|
+ {
|
|
|
|
+ get { return selectedIndex; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref selectedIndex, value);
|
|
|
|
+
|
|
|
|
+ if(SelectedIndex==ItemSource.Count-1)
|
|
|
|
+ {
|
|
|
|
+ SignUpVisible = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ SignUpVisible = Visibility.Collapsed;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(SelectedIndex==0)
|
|
|
|
+ {
|
|
|
|
+ NextTimeVisible = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ NextTimeVisible = Visibility.Collapsed;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Visibility signUpVisible = Visibility.Collapsed;
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 是否显示SignUp按钮
|
|
|
|
+ /// </summary>
|
|
|
|
+ public Visibility SignUpVisible
|
|
|
|
+ {
|
|
|
|
+ get { return signUpVisible; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref signUpVisible, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Visibility nexttimeVisible;
|
|
|
|
+
|
|
|
|
+ public Visibility NextTimeVisible
|
|
|
|
+ {
|
|
|
|
+ get { return nexttimeVisible; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref nexttimeVisible, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public DelegateCommand NextPageCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand PrePageCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand NextTimeCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand SignUpCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public ObservableCollection<GuidItemModel> ItemSource { get; set; }
|
|
|
|
+
|
|
|
|
+ private IDialogService dialog;
|
|
|
|
+
|
|
|
|
+ public NoviceGuidDialogViewModel(IDialogService dialogService)
|
|
|
|
+ {
|
|
|
|
+ dialog = dialogService;
|
|
|
|
+
|
|
|
|
+ NextPageCommand = new DelegateCommand(NextPage,CanNextPageExcute).ObservesProperty(()=>SelectedIndex);
|
|
|
|
+ PrePageCommand = new DelegateCommand(PrePage,CanPrePageExcute).ObservesProperty(()=>SelectedIndex);
|
|
|
|
+ SignUpCommand = new DelegateCommand(SignUp);
|
|
|
|
+
|
|
|
|
+ InitItemSource();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void InitItemSource()
|
|
|
|
+ {
|
|
|
|
+ ItemSource = new ObservableCollection<GuidItemModel>();
|
|
|
|
+ ItemSource.Add(new GuidItemModel() { ImageSource = "pack://application:,,,/PDF Office;component/Resources/GuidItems/Guid_Office.png", Title = "PDF Office 全新体验版", Content = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" });
|
|
|
|
+ ItemSource.Add(new GuidItemModel() { ImageSource = "pack://application:,,,/PDF Office;component/Resources/GuidItems/Guid_Annote.png", Title = "强大的PDF注释工具", Content = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" });
|
|
|
|
+ ItemSource.Add(new GuidItemModel() { ImageSource = "pack://application:,,,/PDF Office;component/Resources/GuidItems/Guid_Convert.png", Title = "将PDF转换为可编辑Office", Content = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" });
|
|
|
|
+ ItemSource.Add(new GuidItemModel() { ImageSource = "pack://application:,,,/PDF Office;component/Resources/GuidItems/Guid_FillAndSign.png", Title = "填写表格,签署商务文件", Content = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" });
|
|
|
|
+ ItemSource.Add(new GuidItemModel() { ImageSource = "pack://application:,,,/PDF Office;component/Resources/GuidItems/Guid_SignUp.png", Title = "注册账号享受全功能", Content = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 前一页
|
|
|
|
+ /// </summary>
|
|
|
|
+ private void NextPage()
|
|
|
|
+ {
|
|
|
|
+ SelectedIndex++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 下一页
|
|
|
|
+ /// </summary>
|
|
|
|
+ private void PrePage()
|
|
|
|
+ {
|
|
|
|
+ SelectedIndex--;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 注册
|
|
|
|
+ /// </summary>
|
|
|
|
+ private void SignUp()
|
|
|
|
+ {
|
|
|
|
+ RequestClose.Invoke(new DialogResult());
|
|
|
|
+ dialog.ShowDialog(DialogNames.RegisterDialog);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 下一次显示
|
|
|
|
+ /// </summary>
|
|
|
|
+ private void NextTime()
|
|
|
|
+ {
|
|
|
|
+ //Todo
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //是否可以执行下一页
|
|
|
|
+ private bool CanNextPageExcute()
|
|
|
|
+ {
|
|
|
|
+ if(SelectedIndex>=ItemSource.Count-1)
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 是否可以执行上一页
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CanPrePageExcute()
|
|
|
|
+ {
|
|
|
|
+ if (SelectedIndex <= 0)
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public bool CanCloseDialog()
|
|
|
|
+ {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void OnDialogClosed()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void OnDialogOpened(IDialogParameters parameters)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|