Example #1
0
        private void _saveButton_Click(object sender, EventArgs e)
        {
            ConfigInstance.Current.PluginName = _pluginNameTextBox.Text;
            ConfigInstance.Current.SDUserName = _sdUserNameTextBox.Text;
            ConfigInstance.Current.SDPassword = _sdPasswordTextBox.Text;
            if (_channelNameFormat.SelectedItem != null)
            {
                ConfigInstance.Current.ChannelNameFormat = _channelNameFormat.SelectedItem.ToString();
            }
            else
            {
                ConfigInstance.Current.ChannelNameFormat = _channelNameFormat.Text;
            }
            ConfigInstance.Current.NrOfDaysToImport = (int)_nrDaysNumericUpDown.Value;
            ConfigInstance.Current.ProxyUserName    = _proxyUserNameTextBox.Text;
            ConfigInstance.Current.ProxyPassword    = _proxyPasswordTextBox.Text;
            if (_updatesAllDays.Checked)
            {
                ConfigInstance.Current.UpdateMode = Config.UpDateMode.AllDays;
            }
            else
            {
                ConfigInstance.Current.UpdateMode = Config.UpDateMode.NextDayOnly;
            }
            ConfigInstance.Current.UpdateChannelNames = _updateChannelNamesCheckBox.Checked;
            ConfigInstance.Save();

            this.Close();
        }
Example #2
0
        public void Import(List <ImportGuideChannel> skipChannels, ImportDataCallback importDataCallback, ProgressCallback progressCallback, FeedbackCallback feedbackCallback, KeepImportServiceAliveCallback keepImportServiceAliveCallback)
        {
            keepImportServiceAliveCallback();
            DateTime todeey = DateTime.Now;

            DateTime startDate = todeey;
            DateTime endDate   = todeey.AddDays(ConfigInstance.Current.NrOfDaysToImport);

            if (ConfigInstance.Current.UpdateMode == Config.UpDateMode.NextDayOnly)
            {
                endDate = startDate;
                DateTime lastImportedDay = ConvertIntAsDateTime(ConfigInstance.Current.LastImportedDay);

                if (lastImportedDay > startDate)
                {
                    Logger.Write(FormatForLogger(DateTime.Now.ToLongTimeString() + " : Calling Import for updates for one day : " + startDate.ToLongTimeString()));

                    Import(skipChannels, importDataCallback, progressCallback, feedbackCallback, keepImportServiceAliveCallback, ConvertStartDateTimeToString(startDate, true), ConvertEndDateTimeToString(startDate.AddHours(25), true));
                    Logger.Write(FormatForLogger(DateTime.Now.ToLongTimeString() + " : End of one day Import"));

                    startDate = lastImportedDay;
                }

                endDate = todeey.AddDays(ConfigInstance.Current.NrOfDaysToImport);
                if (endDate > startDate)
                {
                    Logger.Write(FormatForLogger(DateTime.Now.ToLongTimeString() + " : Calling Import for new data : " + startDate.ToLongTimeString()));

                    Import(skipChannels, importDataCallback, progressCallback, feedbackCallback, keepImportServiceAliveCallback, ConvertStartDateTimeToString(startDate), ConvertEndDateTimeToString(endDate));
                }
            }
            else
            {
                Import(skipChannels, importDataCallback, progressCallback, feedbackCallback, keepImportServiceAliveCallback, ConvertStartDateTimeToString(startDate), ConvertEndDateTimeToString(endDate));
            }
            Logger.Write(FormatForLogger(DateTime.Now.ToLongTimeString() + " : End of new data Import"));

            ConfigInstance.Current.LastImportedDay = ConvertDateTimeAsDateInt(endDate);
            ConfigInstance.Save();
        }