Esempio n. 1
0
        public PresetsForm(List<PresetSettings> allPresets, PresetSettings activePreset)
            : this()
        {
            Presets = new List<PresetSettings>();
            Presets.AddRange(allPresets);
            _activePreset = activePreset;

            listBox1.Items.AddRange(allPresets.ToArray());
            if (_activePreset != null)
            {
                textBox1.Text = _activePreset.Name;
            }
            else
            {
                button2.Enabled = false;
            }

            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.groupBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SAVED);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_DELETE);
            this.groupBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CURRENT);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.button2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SAVE);
            this.button3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_OK);
        }
Esempio n. 2
0
        public PresetsForm(List <PresetSettings> allPresets, PresetSettings activePreset)
            : this()
        {
            Presets = new List <PresetSettings>();
            Presets.AddRange(allPresets);
            _activePreset = activePreset;

            listBox1.Items.AddRange(allPresets.ToArray());
            if (_activePreset != null)
            {
                textBox1.Text = _activePreset.Name;
            }
            else
            {
                button2.Enabled = false;
            }

            this.Text           = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.groupBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SAVED);
            this.button1.Text   = Utils.LanguageSupport.Instance.GetTranslation(STR_DELETE);
            this.groupBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CURRENT);
            this.label1.Text    = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.button2.Text   = Utils.LanguageSupport.Instance.GetTranslation(STR_SAVE);
            this.button3.Text   = Utils.LanguageSupport.Instance.GetTranslation(STR_OK);
        }
Esempio n. 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     _activePreset.Name = textBox1.Text;
     Presets.Add(_activePreset);
     listBox1.Items.Add(_activePreset);
     _activePreset    = null;
     textBox1.Text    = "";
     textBox1.Enabled = false;
     button2.Enabled  = false;
 }
Esempio n. 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     _activePreset.Name = textBox1.Text;
     Presets.Add(_activePreset);
     listBox1.Items.Add(_activePreset);
     _activePreset = null;
     textBox1.Text = "";
     textBox1.Enabled = false;
     button2.Enabled = false;
 }
Esempio n. 5
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem != null)
     {
         CurrentSettings = comboBox1.SelectedItem as PresetSettings;
     }
 }
Esempio n. 6
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem != null)
     {
         CurrentSettings = comboBox1.SelectedItem as PresetSettings;
         button2.Enabled = true;
     }
     else
     {
         button2.Enabled = false;
     }
 }
Esempio n. 7
0
        public GetGeocachesForm(Framework.Interfaces.IPlugin owner, Framework.Interfaces.ICore core)
        {
            InitializeComponent();

            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.groupBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AREACODE);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_LOCATION);
            this.label2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_RADIUS);
            this.label6.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CODES);
            this.label14.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.label7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_HIDDENBY);
            this.radioButtonKm.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_KM);
            this.radioButtonMiles.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MILES);
            this.buttonLocationClear.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CLEAR);
            this.groupBox5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PROPERTIES);
            this.groupBox7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_EXCLUDE);
            this.groupBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_LIMITS);
            this.label5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GEOCACHETYPE);
            this.label16.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CONTAINER);
            this.label8.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_FAVMIN);
            this.label9.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_FAVMAX);
            this.label10.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_DIFMIN);
            this.label11.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_DIFMAX);
            this.label13.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TERMIN);
            this.label12.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TERMAX);
            this.label20.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TRACKMIN);
            this.label19.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TRACKMAX);
            this.label17.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_FOUNDBYUSERS);
            this.label18.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_HIDDENBYUSERS);
            this.checkBoxArchived.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ARCHIVED);
            this.checkBoxAvailable.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AVAILABLE);
            this.checkBoxPremium.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PMO);
            this.label4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TOTALMAX);
            this.label5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAXPERREQUEST);
            this.label3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAXLOGS);
            this.label44.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_COMMASEP);
            this.label46.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PRESET);
            this.buttonImport.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_IMPORT);
            this.button2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_RELOAD);
            this.label48.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PUBLISHED);
            this.label49.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_BETWEEN);
            this.label50.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AND);
            this.label51.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAX30DAYS);

            this.radioButtonKm.Checked = PluginSettings.Instance.UseMetric;
            this.radioButtonMiles.Checked = !PluginSettings.Instance.UseMetric;
            this.numericUpDownLogCount.Value = PluginSettings.Instance.MaxLogs;
            this.numericUpDownMaxPerPage.Value = PluginSettings.Instance.MaxPerRequest;
            this.numericUpDownMaximum.Value = PluginSettings.Instance.TotalMaximum;

            _ownerPlugin = owner as GetGeocaches;
            _core = core;

            foreach (var gt in core.GeocacheTypes)
            {
                if (gt.ID > 0)
                {
                    imageListGeocacheTypes.Images.Add(gt.ID.ToString(), Image.FromFile(Utils.ImageSupport.Instance.GetImagePath(core, Framework.Data.ImageSize.Small, gt)));
                    listViewGeocacheType.Items.Add(new ListViewItem(gt.Name, imageListGeocacheTypes.Images.Count - 1));
                }
            }
            foreach (ListViewItem lvi in listViewGeocacheType.Items)
            {
                lvi.Checked = true;
            }
            foreach (var cnt in core.GeocacheContainers)
            {
                if (cnt.ID > 0)
                {
                    imageListContainers.Images.Add(cnt.ID.ToString(), Image.FromFile(Utils.ImageSupport.Instance.GetImagePath(core, Framework.Data.ImageSize.Small, cnt)));
                    listViewContainer.Items.Add(new ListViewItem(cnt.Name, imageListContainers.Images.Count - 1));
                }
            }
            foreach (ListViewItem lvi in listViewContainer.Items)
            {
                lvi.Checked = true;
            }

            _defaultSettings = CurrentSettings;
            _defaultSettings.Name = Utils.LanguageSupport.Instance.GetTranslation(STR_DEFAULT);
            comboBox1.Items.Add(_defaultSettings);
            LoadPresets();

            if (_core.GeocachingComAccount.MemberTypeId > 1)
            {
                groupBox5.Enabled = true;
                groupBox7.Enabled = true;
            }
            else
            {
                groupBox5.Enabled = false;
                groupBox7.Enabled = false;
            }
        }
Esempio n. 8
0
        private void LoadPresets()
        {
            try
            {
                string xml = PluginSettings.Instance.ApiImportPresets;
                if (!string.IsNullOrEmpty(xml))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList presetNodes = root.SelectNodes("preset");
                    if (presetNodes != null)
                    {
                        bool first = true;
                        foreach (XmlNode n in presetNodes)
                        {
                            PresetSettings ps = new PresetSettings();
                            ps.Name = n.SelectSingleNode("Name").InnerText;
                            ps.CacheTypes = new int[n.SelectSingleNode("CacheTypes").ChildNodes.Count];
                            for (int i = 0; i < ps.CacheTypes.Length; i++)
                            {
                                ps.CacheTypes[i] = int.Parse(n.SelectSingleNode("CacheTypes").ChildNodes[i].InnerText);
                            }
                            ps.Codes = n.SelectSingleNode("Codes").InnerText;
                            ps.Containers = new int[n.SelectSingleNode("Containers").ChildNodes.Count];
                            for (int i = 0; i < ps.Containers.Length; i++)
                            {
                                ps.Containers[i] = int.Parse(n.SelectSingleNode("Containers").ChildNodes[i].InnerText);
                            }
                            ps.DifMax = Utils.Conversion.StringToDouble(n.SelectSingleNode("DifMax").InnerText);
                            ps.DifMin = Utils.Conversion.StringToDouble(n.SelectSingleNode("DifMin").InnerText);
                            if (string.IsNullOrEmpty(n.SelectSingleNode("ExclArchived").InnerText))
                            {
                                ps.ExclArchived = null;
                            }
                            else
                            {
                                ps.ExclArchived = bool.Parse(n.SelectSingleNode("ExclArchived").InnerText);
                            }
                            if (string.IsNullOrEmpty(n.SelectSingleNode("ExclAvailable").InnerText))
                            {
                                ps.ExclAvailable = null;
                            }
                            else
                            {
                                ps.ExclAvailable = bool.Parse(n.SelectSingleNode("ExclAvailable").InnerText);
                            }
                            ps.ExclFoundBy = n.SelectSingleNode("ExclFoundBy").InnerText;
                            ps.ExclHiddenBy = n.SelectSingleNode("ExclHiddenBy").InnerText;
                            if (string.IsNullOrEmpty(n.SelectSingleNode("ExclPMO").InnerText))
                            {
                                ps.ExclPMO = null;
                            }
                            else
                            {
                                ps.ExclPMO = bool.Parse(n.SelectSingleNode("ExclPMO").InnerText);
                            }
                            ps.FavMax = Utils.Conversion.StringToDouble(n.SelectSingleNode("FavMax").InnerText);
                            ps.FavMin = Utils.Conversion.StringToDouble(n.SelectSingleNode("FavMin").InnerText);
                            ps.GeocacheName = n.SelectSingleNode("GeocacheName").InnerText;
                            ps.HiddenBy = n.SelectSingleNode("HiddenBy").InnerText;
                            ps.Km = bool.Parse(n.SelectSingleNode("Km").InnerText);
                            ps.LimitMaxLogs = int.Parse(n.SelectSingleNode("LimitMaxLogs").InnerText);
                            ps.LimitMaxRequest = int.Parse(n.SelectSingleNode("LimitMaxRequest").InnerText);
                            ps.LimitMaxTotal = int.Parse(n.SelectSingleNode("LimitMaxTotal").InnerText);
                            ps.Location = n.SelectSingleNode("Location").InnerText;
                            ps.Radius = Utils.Conversion.StringToDouble(n.SelectSingleNode("Radius").InnerText);
                            ps.TerMax = Utils.Conversion.StringToDouble(n.SelectSingleNode("TerMax").InnerText);
                            ps.TerMin = Utils.Conversion.StringToDouble(n.SelectSingleNode("TerMin").InnerText);
                            ps.TrackMax = Utils.Conversion.StringToDouble(n.SelectSingleNode("TrackMax").InnerText);
                            ps.TrackMin = Utils.Conversion.StringToDouble(n.SelectSingleNode("TrackMin").InnerText);

                            XmlNode btd = n.SelectSingleNode("BetweenPublishedDates");
                            if (btd == null)
                            {
                                ps.BetweenPublishedDates = false;
                            }
                            else
                            {
                                ps.BetweenPublishedDates = false;
                                ps.FromPublishedDate = DateTime.Parse(btd.SelectSingleNode("FromPublishedDate").InnerText);
                                ps.ToPublishedDate = DateTime.Parse(btd.SelectSingleNode("ToPublishedDate").InnerText);
                            }

                            if (first)
                            {
                                first = false;
                                CurrentSettings = ps;
                            }
                            else
                            {
                                _presetSettings.Add(ps);
                                comboBox1.Items.Add(ps);
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }