StephaneLenclud@140: using System;
StephaneLenclud@140: using System.Collections.Generic;
StephaneLenclud@140: using System.Linq;
StephaneLenclud@140: using System.Text;
StephaneLenclud@140: using System.Threading.Tasks;
StephaneLenclud@140: //
StephaneLenclud@171: using SharpLib.Display;
StephaneLenclud@140:
StephaneLenclud@140: namespace SharpDisplayManager
StephaneLenclud@140: {
StephaneLenclud@140: ///
StephaneLenclud@140: /// A UI thread copy of a client relevant data.
StephaneLenclud@140: /// Keeping this copy in the UI thread helps us deal with threading issues.
StephaneLenclud@140: ///
StephaneLenclud@140: public class ClientData
StephaneLenclud@140: {
StephaneLenclud@140: public ClientData(string aSessionId, ICallback aCallback)
StephaneLenclud@140: {
StephaneLenclud@140: SessionId = aSessionId;
StephaneLenclud@140: Name = "";
StephaneLenclud@140: Fields = new List();
StephaneLenclud@140: Layout = new TableLayout(1, 2); //Default to one column and two rows
StephaneLenclud@140: Callback = aCallback;
StephaneLenclud@175: HasNewLayout = true;
StephaneLenclud@140: }
StephaneLenclud@140:
StephaneLenclud@140: public string SessionId { get; set; }
StephaneLenclud@140: public string Name { get; set; }
StephaneLenclud@140: public List Fields { get; set; }
StephaneLenclud@140: public TableLayout Layout { get; set; }
StephaneLenclud@140: public ICallback Callback { get; set; }
StephaneLenclud@141:
StephaneLenclud@175: public bool HasNewLayout { get; set; }
StephaneLenclud@175:
StephaneLenclud@141: //Client management
StephaneLenclud@141: public DateTime LastSwitchTime { get; set; }
StephaneLenclud@176:
StephaneLenclud@176: ///
StephaneLenclud@176: /// Look up the corresponding field in our field collection.
StephaneLenclud@176: ///
StephaneLenclud@176: ///
StephaneLenclud@176: ///
StephaneLenclud@176: public DataField FindSameFieldAs(DataField aField)
StephaneLenclud@176: {
StephaneLenclud@176: foreach (DataField field in Fields)
StephaneLenclud@176: {
StephaneLenclud@176: if (field.IsSameAs(aField))
StephaneLenclud@176: {
StephaneLenclud@176: return field;
StephaneLenclud@176: }
StephaneLenclud@176: }
StephaneLenclud@176:
StephaneLenclud@176: return null;
StephaneLenclud@176: }
StephaneLenclud@176:
StephaneLenclud@176:
StephaneLenclud@176: ///
StephaneLenclud@176: /// Look up the corresponding field in our field collection.
StephaneLenclud@176: ///
StephaneLenclud@176: ///
StephaneLenclud@176: ///
StephaneLenclud@176: public int FindSameFieldIndex(DataField aField)
StephaneLenclud@176: {
StephaneLenclud@176: int i = 0;
StephaneLenclud@176: foreach (DataField field in Fields)
StephaneLenclud@176: {
StephaneLenclud@176: if (field.IsSameAs(aField))
StephaneLenclud@176: {
StephaneLenclud@176: return i;
StephaneLenclud@176: }
StephaneLenclud@176: i++;
StephaneLenclud@176: }
StephaneLenclud@176:
StephaneLenclud@176: return -1;
StephaneLenclud@176: }
StephaneLenclud@176:
StephaneLenclud@176:
StephaneLenclud@140: }
StephaneLenclud@140: }