old_flsystem/应用/NewFans/Class1.cs

101 lines
2.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Api.Framework;
using Api.Framework.SDK;
using Api.Framework.Tools;
using NewFans.Entitys;
using NewFans.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewFans
{
public class Class1 : Plugin
{
public Class1()
{
this.Name = "新粉助手";
this.Note = "新粉助手";
this.Logo = Resources._222;
}
#region
//public static Config Config;
private MainForm mainForm = null;
// public static VariateReplace variateReplace = null;
#endregion
public static Config Config = null;
TaskJob taskJob = null;
public override void Start()
{
try
{
var session = ApiClient.GetSession();
#region
if (!session.TableExist<fl_newfans_hist_>())
{
session.CreateTable<fl_newfans_hist_>();
session.AddUnique<fl_newfans_hist_>("uid");
}
#endregion
//创建配置文件
Config = this.ReadConfig<Config>();
Config.hour3 = 20;//三个小时的改成20分钟了
Config.hour24 = 24 * 60;
Config.hour48 = 48 * 60;
Config.hour72 = 72 * 60;
Util.Save(Config);
taskJob = new TaskJob();
taskJob.Run();
}
catch (Exception ex)
{
this.OnLog(ex.Message);
}
}
public override void ShowForm()
{
try
{
if (mainForm == null || mainForm.IsDisposed)
{
mainForm = new MainForm();
mainForm.Show();
}
mainForm.TopMost = true;
mainForm.TopMost = false;
}
catch (Exception ex)
{
this.OnLog(ex.Message);
}
}
public override void Stop()
{
try
{
//SessionExt.Clear();
if (mainForm != null)
{
mainForm.CloseForm();
mainForm = null;
}
taskJob.Abort();
taskJob = null;
}
catch (Exception ex)
{
this.OnLog(ex.Message);
}
}
}
}