如何从Windows服务项目(相同的解决方案)c#asp.net调用另一个项目的方法

时间:2017-10-24 09:08:36

标签: c# couchbase

我有几个项目和一个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 

        }

0 个答案:

没有答案