mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
日程表内核:自动工作部分
This commit is contained in:
parent
7ab8a0bc43
commit
46dc67a7d8
VPet-Simulator.Windows.Interface
VPet-Simulator.Windows
@ -225,7 +225,12 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有MOD文件位置
|
/// 所有MOD文件位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DirectoryInfo> MODPath { get; }
|
List<DirectoryInfo> MODPath { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// 日程表
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
ScheduleTask ScheduleTask { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,10 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// 联机允许交互
|
/// 联机允许交互
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool MPNOTouch { get; set; }
|
bool MPNOTouch { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 桌宠皮肤(不一定是这个,如果找不到则为默认低0个)
|
||||||
|
/// </summary>
|
||||||
|
string PetGraph { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
using Panuon.WPF;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using static VPet_Simulator.Core.GraphHelper;
|
|
||||||
|
|
||||||
namespace VPet_Simulator.Windows.Interface;
|
|
||||||
/// <summary>
|
|
||||||
/// 日程表基础
|
|
||||||
/// </summary>
|
|
||||||
public class ScheduleItemBase : NotifyPropertyChangedBase
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 工作日程表
|
|
||||||
/// </summary>
|
|
||||||
public class WorkScheduleItem
|
|
||||||
: ScheduleItemBase
|
|
||||||
{
|
|
||||||
public Work work { get; set; }
|
|
||||||
public WorkScheduleItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorkScheduleItem(ImageSource image,
|
|
||||||
string workName,
|
|
||||||
int workTime)
|
|
||||||
{
|
|
||||||
Image = image;
|
|
||||||
WorkName = workName;
|
|
||||||
WorkTime = workTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImageSource Image { get; set; }
|
|
||||||
|
|
||||||
public string WorkName { get; set; }
|
|
||||||
|
|
||||||
public int WorkTime { get; set; }
|
|
||||||
|
|
||||||
public bool IsPreviousIsRest { get => _isPreviousIsRest; set => Set(ref _isPreviousIsRest, value); }
|
|
||||||
private bool _isPreviousIsRest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RestScheduleItem
|
|
||||||
: ScheduleItemBase
|
|
||||||
{
|
|
||||||
public RestScheduleItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public RestScheduleItem(int restTime)
|
|
||||||
{
|
|
||||||
RestTime = restTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int RestTime { get => _restTime; set => Set(ref _restTime, value); }
|
|
||||||
private int _restTime;
|
|
||||||
}
|
|
||||||
}
|
|
241
VPet-Simulator.Windows.Interface/ScheduleTask.cs
Normal file
241
VPet-Simulator.Windows.Interface/ScheduleTask.cs
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
using LinePutScript;
|
||||||
|
using Panuon.WPF;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Timers;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using static VPet_Simulator.Core.GraphHelper;
|
||||||
|
using static VPet_Simulator.Core.GraphHelper.Work;
|
||||||
|
|
||||||
|
namespace VPet_Simulator.Windows.Interface;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日程表功能
|
||||||
|
/// </summary>
|
||||||
|
public class ScheduleTask
|
||||||
|
{
|
||||||
|
public ObservableCollection<ScheduleItemBase> ScheduleItems { get; set; } = [];
|
||||||
|
private IMainWindow mw;
|
||||||
|
public int NowIndex { get; set; } = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 根据设置获取日程表
|
||||||
|
/// </summary>
|
||||||
|
public ScheduleTask(IMainWindow imw)
|
||||||
|
{
|
||||||
|
this.mw = imw;
|
||||||
|
if (mw.GameSavesData.Data.ContainsLine("schedule"))
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
var schedule = mw.GameSavesData.Data["schedule"];
|
||||||
|
while (schedule.Contains(i.ToString()))
|
||||||
|
{
|
||||||
|
var sub = schedule[(gstr)i.ToString()].Split(',');
|
||||||
|
if (sub[0] == "rest")
|
||||||
|
{
|
||||||
|
ScheduleItems.Add(new RestScheduleItem(this, int.Parse(sub[1])));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Work work = mw.Core.Graph.GraphConfig.Works.Find(w => w.Name == sub[0]);
|
||||||
|
if (work != null)
|
||||||
|
{
|
||||||
|
int dbl = int.Parse(sub[1]);
|
||||||
|
switch (work.Type)
|
||||||
|
{
|
||||||
|
case WorkType.Work:
|
||||||
|
ScheduleItems.Add(new WorkScheduleItem(this, work, dbl));
|
||||||
|
break;
|
||||||
|
case WorkType.Study:
|
||||||
|
ScheduleItems.Add(new StudyScheduleItem(this, work, dbl));
|
||||||
|
break;
|
||||||
|
case WorkType.Play:
|
||||||
|
ScheduleItems.Add(new PlayScheduleItem(this, work, dbl));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NowIndex = schedule[(gint)"now"];
|
||||||
|
}
|
||||||
|
imw.Main.WorkTimer.E_FinishWork += WorkTimer_E_FinishWork;
|
||||||
|
RestTimer.Elapsed += RestTimer_Elapsed;
|
||||||
|
RestTimer.Start();
|
||||||
|
}
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
mw.GameSavesData.Data["schedule"].Clear();
|
||||||
|
mw.GameSavesData.Data["schedule"][(gint)"now"] = NowIndex;
|
||||||
|
for (int i = 0; i < ScheduleItems.Count; i++)
|
||||||
|
{
|
||||||
|
if (ScheduleItems[i] is RestScheduleItem rsi)
|
||||||
|
{
|
||||||
|
mw.GameSavesData.Data["schedule"][(gstr)i.ToString()] = $"rest,{rsi.RestTime}";
|
||||||
|
}
|
||||||
|
else if (ScheduleItems[i] is WorkScheduleItem wsi)
|
||||||
|
{
|
||||||
|
mw.GameSavesData.Data["schedule"][(gstr)i.ToString()] = $"{wsi.Work.Name},{wsi.DBL}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RestTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
if (RestTime-- < 0)
|
||||||
|
return;
|
||||||
|
if (RestTime == 0)
|
||||||
|
{
|
||||||
|
StartWork();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RestTimer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartWork()
|
||||||
|
{
|
||||||
|
RestTime = -100;
|
||||||
|
if (ScheduleItems.Count > 0)
|
||||||
|
{
|
||||||
|
if (NowIndex >= ScheduleItems.Count)
|
||||||
|
{
|
||||||
|
NowIndex = 0;
|
||||||
|
}
|
||||||
|
if (ScheduleItems[NowIndex] is WorkScheduleItem wsi)
|
||||||
|
{
|
||||||
|
mw.Main.StartWork(wsi.Work);
|
||||||
|
NowIndex++;
|
||||||
|
}
|
||||||
|
else if (ScheduleItems[NowIndex] is RestScheduleItem rsi)
|
||||||
|
{
|
||||||
|
NowIndex++;
|
||||||
|
RestTime = rsi.RestTime * 2;
|
||||||
|
RestTimer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int RestTime = 2;
|
||||||
|
private Timer RestTimer = new Timer()
|
||||||
|
{
|
||||||
|
Interval = 30000,
|
||||||
|
AutoReset = false
|
||||||
|
};
|
||||||
|
|
||||||
|
private void WorkTimer_E_FinishWork(Core.WorkTimer.FinishWorkInfo obj) => StartWork();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日程表日程
|
||||||
|
/// </summary>
|
||||||
|
public class ScheduleItemBase : NotifyPropertyChangedBase
|
||||||
|
{
|
||||||
|
public ScheduleItemBase(ScheduleTask task)
|
||||||
|
{
|
||||||
|
Task = task;
|
||||||
|
}
|
||||||
|
public ScheduleTask Task;
|
||||||
|
/// <summary>
|
||||||
|
/// 休息时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual int RestTime { get; set; } = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 工作时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual int WorkTime { get; set; } = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是当前正在进行的日程
|
||||||
|
/// </summary>
|
||||||
|
public bool IsNow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (Task.ScheduleItems.Count < Task.NowIndex)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Task.ScheduleItems[Task.NowIndex] == this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 工作日程表日程
|
||||||
|
/// </summary>
|
||||||
|
public class WorkScheduleItem
|
||||||
|
: ScheduleItemBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 翻倍倍率
|
||||||
|
/// </summary>
|
||||||
|
public int DBL { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 当前绑定工作
|
||||||
|
/// </summary>
|
||||||
|
public Work Work { get; set; }
|
||||||
|
public WorkScheduleItem(ScheduleTask task, Work work, int dbl) : base(task)
|
||||||
|
{
|
||||||
|
this.Work = work;
|
||||||
|
string source = task.mw.ImageSources.FindSource("work_" + task.mw.Set.PetGraph + "_" + work.Graph) ?? task.mw.ImageSources.FindSource("work_" + task.mw.Set.PetGraph + "_" + work.Name);
|
||||||
|
task.mw.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (source == null)
|
||||||
|
{
|
||||||
|
//尝试显示默认图像
|
||||||
|
Image = task.mw.ImageSources.FindImage("work_" + task.mw.Set.PetGraph + "_t_" + work.Type.ToString(), "work_" + work.Type.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Image = ImageResources.NewSafeBitmapImage(source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageSource Image { get; set; }
|
||||||
|
|
||||||
|
public string WorkName => Work.NameTrans;
|
||||||
|
|
||||||
|
public override int WorkTime => Work.Time;
|
||||||
|
|
||||||
|
public bool IsPreviousIsRest { get => _isPreviousIsRest; set => Set(ref _isPreviousIsRest, value); }
|
||||||
|
private bool _isPreviousIsRest;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 学习日程表日程
|
||||||
|
/// </summary>
|
||||||
|
public class StudyScheduleItem : WorkScheduleItem
|
||||||
|
{
|
||||||
|
public StudyScheduleItem(ScheduleTask task, Work work, int dbl) : base(task, work, dbl)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 工作日程表日程
|
||||||
|
/// </summary>
|
||||||
|
public class PlayScheduleItem : WorkScheduleItem
|
||||||
|
{
|
||||||
|
public PlayScheduleItem(ScheduleTask task, Work work, int dbl) : base(task, work, dbl)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public override int WorkTime => Work.Time / 2;
|
||||||
|
public override int RestTime => Work.Time / 2;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 休息日程表日程
|
||||||
|
/// </summary>
|
||||||
|
public class RestScheduleItem
|
||||||
|
: ScheduleItemBase
|
||||||
|
{
|
||||||
|
public RestScheduleItem(ScheduleTask task, int restTime) : base(task)
|
||||||
|
{
|
||||||
|
RestTime = restTime;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 休息时间
|
||||||
|
/// </summary>
|
||||||
|
public override int RestTime { get => _restTime; set => Set(ref _restTime, value); }
|
||||||
|
private int _restTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -220,6 +220,9 @@ namespace VPet_Simulator.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
//保存日程表
|
||||||
|
ScheduleTask?.Save();
|
||||||
|
//保存插件
|
||||||
foreach (MainPlugin mp in Plugins)
|
foreach (MainPlugin mp in Plugins)
|
||||||
mp.Save();
|
mp.Save();
|
||||||
//游戏存档
|
//游戏存档
|
||||||
@ -1598,6 +1601,8 @@ namespace VPet_Simulator.Windows
|
|||||||
};
|
};
|
||||||
MusicTimer.Elapsed += MusicTimer_Elapsed;
|
MusicTimer.Elapsed += MusicTimer_Elapsed;
|
||||||
|
|
||||||
|
//日程表加载
|
||||||
|
ScheduleTask = new ScheduleTask(this);
|
||||||
|
|
||||||
|
|
||||||
//await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载游戏动画".Translate()));
|
//await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载游戏动画".Translate()));
|
||||||
|
@ -91,4 +91,9 @@ public partial class MainWindow
|
|||||||
/// 当前启用主题
|
/// 当前启用主题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Theme Theme = null;
|
public Theme Theme = null;
|
||||||
|
/// <summary>
|
||||||
|
/// 日程表
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public ScheduleTask ScheduleTask { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@
|
|||||||
<ItemsControl x:Name="icSchedule"
|
<ItemsControl x:Name="icSchedule"
|
||||||
ItemTemplateSelector="{StaticResource ScheduleItemTemplateSelector}">
|
ItemTemplateSelector="{StaticResource ScheduleItemTemplateSelector}">
|
||||||
<ItemsControl.Resources>
|
<ItemsControl.Resources>
|
||||||
<DataTemplate x:Key="WorkScheduleTemplate">
|
<DataTemplate x:Key="WorkScheduleItem">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Margin="-20,-5,0,-5" HorizontalAlignment="Left"
|
<Button Margin="-20,-5,0,-5" HorizontalAlignment="Left"
|
||||||
Visibility="{Binding IsPreviousIsRest, Converter={x:Static pu:Converters.TrueToCollapseConverter}}"
|
Visibility="{Binding IsPreviousIsRest, Converter={x:Static pu:Converters.TrueToCollapseConverter}}"
|
||||||
@ -378,7 +378,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="StudyScheduleTemplate">
|
<DataTemplate x:Key="StudyScheduleItem">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Margin="-20,-5,0,-5" HorizontalAlignment="Left"
|
<Button Margin="-20,-5,0,-5" HorizontalAlignment="Left"
|
||||||
Visibility="{Binding IsPreviousIsRest, Converter={x:Static pu:Converters.TrueToCollapseConverter}}"
|
Visibility="{Binding IsPreviousIsRest, Converter={x:Static pu:Converters.TrueToCollapseConverter}}"
|
||||||
@ -430,7 +430,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="PlayScheduleTemplate">
|
<DataTemplate x:Key="PlayScheduleItem">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Margin="-20,-5,0,-5" HorizontalAlignment="Left"
|
<Button Margin="-20,-5,0,-5" HorizontalAlignment="Left"
|
||||||
Visibility="{Binding IsPreviousIsRest, Converter={x:Static pu:Converters.TrueToCollapseConverter}}"
|
Visibility="{Binding IsPreviousIsRest, Converter={x:Static pu:Converters.TrueToCollapseConverter}}"
|
||||||
@ -482,7 +482,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="RestScheduleTemplate">
|
<DataTemplate x:Key="RestScheduleItem">
|
||||||
<Border Margin="0,7,0,7" Height="30" CornerRadius="5"
|
<Border Margin="0,7,0,7" Height="30" CornerRadius="5"
|
||||||
Padding="0,3" Background="#F1F2F3">
|
Padding="0,3" Background="#F1F2F3">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -14,7 +14,7 @@ using System.Windows.Threading;
|
|||||||
using VPet_Simulator.Core;
|
using VPet_Simulator.Core;
|
||||||
using VPet_Simulator.Windows.Interface;
|
using VPet_Simulator.Windows.Interface;
|
||||||
using static VPet_Simulator.Core.GraphHelper;
|
using static VPet_Simulator.Core.GraphHelper;
|
||||||
using static VPet_Simulator.Windows.Interface.ScheduleItemBase;
|
using static VPet_Simulator.Windows.Interface.ScheduleTask;
|
||||||
|
|
||||||
namespace VPet_Simulator.Windows;
|
namespace VPet_Simulator.Windows;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -31,7 +31,7 @@ public partial class winWorkMenu : WindowX
|
|||||||
private readonly ObservableCollection<string> _studyDetails = new ObservableCollection<string>();
|
private readonly ObservableCollection<string> _studyDetails = new ObservableCollection<string>();
|
||||||
private readonly ObservableCollection<string> _playDetails = new ObservableCollection<string>();
|
private readonly ObservableCollection<string> _playDetails = new ObservableCollection<string>();
|
||||||
private readonly ObservableCollection<string> _starDetails = new ObservableCollection<string>();
|
private readonly ObservableCollection<string> _starDetails = new ObservableCollection<string>();
|
||||||
private readonly ObservableCollection<ScheduleItemBase> _schedules = new ObservableCollection<ScheduleItemBase>();
|
private readonly ObservableCollection<ScheduleItemBase> _schedules;
|
||||||
public void ShowImageDefault(Work.WorkType type)
|
public void ShowImageDefault(Work.WorkType type)
|
||||||
{
|
{
|
||||||
Dispatcher.BeginInvoke(() =>
|
Dispatcher.BeginInvoke(() =>
|
||||||
@ -77,17 +77,7 @@ public partial class winWorkMenu : WindowX
|
|||||||
ShowImageDefault(type);
|
ShowImageDefault(type);
|
||||||
AllowChange = true;
|
AllowChange = true;
|
||||||
|
|
||||||
_schedules.Add(new WorkScheduleItem(
|
_schedules = mw.ScheduleTask.ScheduleItems;
|
||||||
mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_t_" + type.ToString(), "work_" + type.ToString()),
|
|
||||||
"学习",
|
|
||||||
60
|
|
||||||
));
|
|
||||||
_schedules.Add(new RestScheduleItem(10));
|
|
||||||
_schedules.Add(new WorkScheduleItem(
|
|
||||||
mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_t_" + type.ToString(), "work_" + type.ToString()),
|
|
||||||
"学习",
|
|
||||||
70
|
|
||||||
));
|
|
||||||
|
|
||||||
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "---");
|
ComboBoxHelper.SetWatermark(detailTypes, "---" + "请选择".Translate() + "---");
|
||||||
|
|
||||||
@ -322,12 +312,9 @@ public partial class winWorkMenu : WindowX
|
|||||||
if (item is WorkScheduleItem workItem)
|
if (item is WorkScheduleItem workItem)
|
||||||
{
|
{
|
||||||
workItem.IsPreviousIsRest = lastItem is RestScheduleItem;
|
workItem.IsPreviousIsRest = lastItem is RestScheduleItem;
|
||||||
workTime += workItem.WorkTime;
|
|
||||||
}
|
|
||||||
else if (item is RestScheduleItem restItem)
|
|
||||||
{
|
|
||||||
restTime += restItem.RestTime;
|
|
||||||
}
|
}
|
||||||
|
workTime += item.WorkTime;
|
||||||
|
restTime += item.RestTime;
|
||||||
}
|
}
|
||||||
rpgbSchedule.Maximum = workTime + restTime;
|
rpgbSchedule.Maximum = workTime + restTime;
|
||||||
rpgbSchedule.Value = workTime;
|
rpgbSchedule.Value = workTime;
|
||||||
@ -389,13 +376,13 @@ public partial class winWorkMenu : WindowX
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_schedules.Add(new RestScheduleItem(30));
|
_schedules.Add(new RestScheduleItem(mw.ScheduleTask, 30));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var index = _schedules.IndexOf(scheduleItem);
|
var index = _schedules.IndexOf(scheduleItem);
|
||||||
_schedules.Insert(index, new RestScheduleItem(30));
|
_schedules.Insert(index, new RestScheduleItem(mw.ScheduleTask, 30));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,14 +456,22 @@ internal class ScheduleItemTemplateSelector
|
|||||||
{
|
{
|
||||||
var element = container as FrameworkElement;
|
var element = container as FrameworkElement;
|
||||||
|
|
||||||
if (item is WorkScheduleItem workItem)
|
return element.FindResource(item.GetType().ToString()) as DataTemplate;
|
||||||
{
|
//if (item is WorkScheduleItem)
|
||||||
return element.FindResource("WorkScheduleTemplate") as DataTemplate;
|
//{
|
||||||
}
|
// return element.FindResource("WorkScheduleTemplate") as DataTemplate;
|
||||||
else if (item is RestScheduleItem restItem)
|
//}
|
||||||
{
|
//else if (item is StudyScheduleItem)
|
||||||
return element.FindResource("RestScheduleTemplate") as DataTemplate;
|
//{
|
||||||
}
|
// return element.FindResource("StudyScheduleItem") as DataTemplate;
|
||||||
throw new NotImplementedException();
|
//}
|
||||||
|
//else if (item is PlayScheduleItem)
|
||||||
|
//{
|
||||||
|
// return element.FindResource("PlayScheduleItem") as DataTemplate;
|
||||||
|
//}
|
||||||
|
//else if (item is RestScheduleItem)
|
||||||
|
//{
|
||||||
|
// return element.FindResource("RestScheduleTemplate") as DataTemplate;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user