public DailyMileLogon(DailyMileConnectionInfo connectionInfo)
     : base()
 {
     _connectionInfo = connectionInfo;
     InitializeComponent();
 }
        public static bool SaveConnectionInfo(string fileName, DailyMileConnectionInfo info)
        {
            try
            {
                byte[] data = Serializers.Serialize(info);
                using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    fs.Write(data, 0, data.Length);
                }

                return true;
            }
            catch { }

            return false;
        }
 public DailyMileAPI(DailyMileConnectionInfo connectionInfo)
 {
     _connectionInfo = connectionInfo;
 }
Beispiel #4
0
        private void SetupDMConnectionInfo()
        {
            _logger.EnQueueAppTraceMessage("SetupDMConnectionInfo() Enter");
            //IsTokenStillValid
            _dmConnectionInfo = DailyMileConnectionInfo.ReadConnectionInfo(_ConfigFileName);
            if (_dmConnectionInfo == null)
            {
                _logger.EnQueueAppTraceMessage("SetupDMConnectionInfo() Creating New");
                _dmConnectionInfo = new DailyMileConnectionInfo();
                _dmConnectionInfo.DailyMileURL = "https://api.dailymile.com";

                //Add your API Info here
                _dmConnectionInfo.RedirectURL = "";
                _dmConnectionInfo.ClientID = "";
                _dmConnectionInfo.ClientSecret = "";
                _dmConnectionInfo.IsLoggedIn = false;
                SetLoggedOnControlValues(false);
            }
            else
            {
                _logger.EnQueueAppTraceMessage("SetupDMConnectionInfo() Loaded");
                SetLoggedOnControlValues(_dmConnectionInfo.IsTokenStillValid);

            }

            _dmConnectionInfo.ConfigFileLocation = _ConfigFileName;

            _APIWrapper = new DailyMileAPI(_dmConnectionInfo);

            //LogonDailyMile
            _logger.EnQueueAppTraceMessage("SetupDMConnectionInfo() Leave");
        }