92 lines
2.5 KiB
C#
92 lines
2.5 KiB
C#
using Api.Framework;
|
||
using Api.Framework.Cps;
|
||
using Api.Framework.Enums;
|
||
using Api.Framework.SDK;
|
||
using Api.Framework.Tools;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using Weixin.JDCirclePromotion.Entitys;
|
||
using Weixin.JDCirclePromotion.Properties;
|
||
|
||
namespace Weixin.JDCirclePromotion
|
||
{
|
||
public class Class1 : Plugin
|
||
{
|
||
public Class1()
|
||
{
|
||
this.Name = Resources.PluginName;
|
||
this.Note = Resources.PluginNote;
|
||
this.Logo = Resources.京东发单;
|
||
}
|
||
|
||
#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_jdcirclepromotion_goodsinfos>()) session.CreateTable<fl_plugin_jdcirclepromotion_goodsinfos>();
|
||
#endregion
|
||
|
||
SDK.ReciveIMEvent += SDK_ReciveIMEvent;
|
||
|
||
Config = this.ReadConfig<Config>(); //创建配置文件
|
||
TimerTask.NewTimer<SendCircleFriendThread>(60); //创建线程 - 发送朋友圈的线程 60秒
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
this.OnLog(ex.Message);
|
||
}
|
||
}
|
||
|
||
private void SDK_ReciveIMEvent(object sender, ReciveIMEvent e)
|
||
{}
|
||
|
||
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<SendCircleFriendThread>(); //关闭线程
|
||
if (mainForm != null)
|
||
{
|
||
mainForm.CloseForm(); //关闭窗体
|
||
mainForm = null;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
this.OnLog(ex.Message);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|