我有几个项目和一个Windows服务项目C#。我想从windows服务项目中使用A1项目的静态方法。当然我添加了参考但我无法访问该方法。该方法可以访问Couchbase(Nosql)。例如:创建,插入,更新等...如果您有一些经验,请帮助我。
class Trigger_class // this class in windows service project
{
static double scheduledHour = 12;
static double scheduleMinute = 42;
static DateTime scheduleTime;
//static TimeSpan _ScheduledRunningTime = new TimeSpan(16,00,00);
System.Timers.Timer Timer = null;
double interval = 10;
public Trigger_class()
{
scheduleTime = DateTime.Today.AddHours(scheduledHour).AddMinutes(scheduleMinute);
}
public void Start()
{
Timer = new System.Timers.Timer(interval);
Timer.AutoReset = true;
Timer.Enabled = true;
Timer.Start();
Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
DateTime now = DateTime.Now;
if (scheduleTime < DateTime.Now)
{
scheduleTime = scheduleTime.AddHours(24);
mix_plan.computeNextDayPlan(); // <-- This is A1's static method
}