85 lines
2.2 KiB
C#
85 lines
2.2 KiB
C#
using Api.Framework;
|
||
using Api.Framework.SDK;
|
||
using Api.Framework.Tools;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using Weixin.AccurateCircle.Entitys;
|
||
using Weixin.AccurateCircle.Properties;
|
||
|
||
namespace Weixin.AccurateCircle
|
||
{
|
||
public class Class1 : Plugin
|
||
{
|
||
public Class1()
|
||
{
|
||
this.Logo = Resources.精准朋友圈;
|
||
this.Name = Resources.PluginName;
|
||
this.Note = Resources.PluginNote;
|
||
}
|
||
|
||
#region 自定义变量
|
||
public static Config Config;
|
||
private MainForm mainForm = null;
|
||
#endregion
|
||
|
||
public override void Start()
|
||
{
|
||
try
|
||
{
|
||
var session = ApiClient.GetSession();
|
||
#region 判断表是否存在,不存在创建表
|
||
if (!session.TableExist<fl_plugin_accuratecircle_dataInfos>()) session.CreateTable<fl_plugin_accuratecircle_dataInfos>();
|
||
#endregion
|
||
|
||
//创建配置文件
|
||
Config = this.ReadConfig<Config>();
|
||
|
||
TimerTask.NewTimer<MonitorThread>(60); //创建线程 - 10秒
|
||
}
|
||
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
|
||
{
|
||
TimerTask.Close<MonitorThread>();
|
||
if (mainForm != null)
|
||
{
|
||
mainForm.CloseForm();
|
||
mainForm = null;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
this.OnLog(ex.Message);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|