old_flsystem/应用/Weixin.JDCirclePromotion/Class1.cs

92 lines
2.5 KiB
C#
Raw Normal View History

2022-09-20 03:10:29 +00:00
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);
}
}
}
}