[Solved] linking timers to variables [closed]


Well as you have not shown us any code, let me assume that you at least have a class to encapsulate order.

public class Order
{
    public int OrderNumber{get;set;}

    ///other properties
}

Now if you add following two properties and a method, your problem is resolved.

    public class Order
{
    public int OrderNumber{get;set;}

    //other properties

    public DateTime OrderPlacedOn{get;set;}
    public DateTime OrderCompletedOn{get;set;}

    public TimeSpan TimeToComplete()
    {
        if(OrderCompletedOn==DateTime.MinValue)//order not completed yet
            return TimeSpan.FromSeconds(0);

        return OrderCompletedOn - OrderPlacedOn;
    }
}

This saves you from keeping countless timers. You can set values of start and complete on clicking of your buttons.

2

solved linking timers to variables [closed]