private async void button2_Click(object sender, EventArgs e) { this.ControlBox = false; panel1.Enabled = false; buttonCancel.Visible = true; _cancelled = false; _logType = comboBoxLogType1.SelectedItem as Framework.Data.LogType; _visitDate = dateTimePicker1.Value.Date; _logText = textBox2.Text; _gcCode = textBox3.Text.ToUpper().Trim(); _stopAfterEachLog = checkBoxStopAfterEachLog.Checked; _errormessage = null; _tbs = new List <string>(); _tbs.AddRange((from int a in checkedListBox1.CheckedIndices orderby a select(string) checkedListBox1.Items[a]).ToArray()); if (_tbs.Count > 0) { toolStripProgressBar1.Value = 0; toolStripProgressBar1.Maximum = _tbs.Count; await Task.Run(() => { this.logThreadMethod(); }); if (!string.IsNullOrEmpty(_errormessage)) { System.Windows.Forms.MessageBox.Show(_errormessage, Utils.LanguageSupport.Instance.GetTranslation(Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR)), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } buttonCancel.Visible = false; this.ControlBox = true; panel1.Enabled = true; }
protected void addLogType(int id, string name, bool asFound) { Framework.Data.LogType lt = new Framework.Data.LogType(); lt.ID = id; lt.Name = name; lt.AsFound = asFound; Core.LogTypes.Add(lt); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Framework.Data.LogType gct = value as Framework.Data.LogType; if (gct != null) { return(Utils.ImageSupport.Instance.GetImagePath(LogViewerForm.FixedCore, Framework.Data.ImageSize.Small, gct)); } return(null); }
public static Framework.Data.LogType GetLogType(Framework.Data.LogTypeCollection ltCollection, string keyWord) { Framework.Data.LogType result = null; keyWord = keyWord.ToLower(); result = (from gt in ltCollection where gt.Name.ToLower().Contains(keyWord) select gt).FirstOrDefault(); if (result == null) { //take special ID result = GetLogType(ltCollection, 0); } return(result); }
public static Framework.Data.LogType GetLogType(Framework.Data.LogTypeCollection ltCollection, int typeId) { Framework.Data.LogType result = null; result = (from gt in ltCollection where gt.ID == typeId select gt).FirstOrDefault(); if (result == null) { //take special ID result = (from gt in ltCollection where gt.ID == 0 select gt).FirstOrDefault(); } return(result); }
private void comboBoxLogType1_SelectedIndexChanged(object sender, EventArgs e) { Framework.Data.LogType gt = comboBoxLogType1.SelectedItem as Framework.Data.LogType; if (gt == null) { buttonSubmit.Enabled = false; checkBox1.Enabled = false; } else { buttonSubmit.Enabled = true; checkBox1.Enabled = gt.AsFound; } if (!checkBox1.Enabled) { checkBox1.Checked = false; } }
private async void buttonSubmit_Click(object sender, EventArgs e) { if (_gc != null && (comboBoxLogType1.SelectedItem as Framework.Data.LogType) != null) { panel1.Enabled = false; panel2.Enabled = false; panel3.Enabled = false; Cursor = Cursors.WaitCursor; _logDate = dateTimePicker1.Value.Date; _logType = (comboBoxLogType1.SelectedItem as Framework.Data.LogType); _tbs14 = (from string a in checkedListBox1.CheckedItems select a.Split(new char[] { ',' }, 2)[0]).ToList(); _tbs75 = (from string a in checkedListBox2.CheckedItems select a.Split(new char[] { ',' }, 2)[0]).ToList(); _logText = textBox1.Text; _addToFavorites = checkBox1.Checked; using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(_core)) { await Task.Run(() => { this.logThreadMethod(); }); } if (!string.IsNullOrEmpty(_errormessage)) { System.Windows.Forms.MessageBox.Show(_errormessage, Utils.LanguageSupport.Instance.GetTranslation(Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR)), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } else if (!AskForNext || textBoxGC.ReadOnly || System.Windows.Forms.MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_OKANOTHER), Utils.LanguageSupport.Instance.GetTranslation(STR_SUCCESS), System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } panel3.Enabled = true; panel2.Enabled = true; panel1.Enabled = true; toolStripStatusLabel1.Visible = false; toolStripStatusLabel1.Text = ""; } Cursor = Cursors.Default; }
private async void buttonSubmit_Click(object sender, EventArgs e) { panel1.Enabled = false; panel2.Enabled = false; this.ControlBox = false; _logDate = dateTimePicker1.Value.Date; _logType = (comboBoxLogType1.SelectedItem as Framework.Data.LogType); _tbs75 = (from string a in checkedListBox1.CheckedItems select a.Split(new char[] { ',' }, 2)[0]).ToList(); _logText = textBox2.Text; _foundcount = (int)numericUpDown1.Value; if (checkBox1.Checked) { _gcList = ((from int a in listView1.CheckedIndices orderby a select(Framework.Data.Geocache) listView1.Items[a].Tag).Take(1).ToList()); } else { _gcList = ((from int a in listView1.CheckedIndices orderby a select(Framework.Data.Geocache) listView1.Items[a].Tag).ToList()); } using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(_core)) { await Task.Run(() => { this.logThreadMethod(); }); } if (!string.IsNullOrEmpty(_errormessage)) { System.Windows.Forms.MessageBox.Show(_errormessage, Utils.LanguageSupport.Instance.GetTranslation(Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR)), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } numericUpDown1.Value = _foundcount; panel2.Enabled = true; panel1.Enabled = true; toolStripStatusLabel1.Visible = false; toolStripStatusLabel1.Text = ""; this.ControlBox = true; }
public string GetImagePath(Framework.Data.ImageSize imageSize, Framework.Data.LogType logType) { string result; string fn; fn = string.Format("{0}.gif", logType.ID); result = Path.Combine(new string[] { _baseImagePath, imageSize.ToString(), "logtypes", fn }); if (!File.Exists(result)) { if (imageSize != Framework.Data.ImageSize.Default) { result = Path.Combine(new string[] { _baseImagePath, imageSize.ToString(), "logtypes", fn }); if (!File.Exists(result)) { result = null; } } else { result = null; } } return(result); }
public string GetImagePath(Framework.Interfaces.ICore core, Framework.Data.ImageSize imageSize, Framework.Data.LogType logType) { string result = null; foreach (Framework.Interfaces.IImageResource ir in _imageResourcePlugins) { result = ir.GetImagePath(imageSize, logType); if (!string.IsNullOrEmpty(result)) { break; } } if (result == null && imageSize != Framework.Data.ImageSize.Default) { result = GetImagePath(core, Framework.Data.ImageSize.Default, logType); } else if (string.IsNullOrEmpty(result)) { //select default result = GetDefaultImagePath(imageSize); } return(result); }
public Engine() { try { _settingsProvider = new SettingsProvider(null); string[] args = Environment.GetCommandLineArgs(); if (EnablePluginDataPathAtStartup || (args != null && args.Contains("/f"))) { using (SelectSettingsForm dlg = new SelectSettingsForm(this)) { _pluginDataFolderSelected = dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK; } } else { _pluginDataFolderSelected = true; } if (_pluginDataFolderSelected) { _geocachingAccountNames = new Framework.Data.GeocachingAccountNames(); var p = _settingsProvider.GetSettingsValueStringCollection("Core.GeocachingAccountNames", null); if (p != null) { foreach (string s in p) { string[] parts = s.Split("|".ToArray(), 2); if (parts.Length == 2) { _geocachingAccountNames.SetAccountName(parts[0], parts[1]); } } } _geocachingAccountNames.Changed += new Framework.EventArguments.GeocachingAccountNamesEventHandler(_geocachingAccountNames_Changed); _geocachingComAccount = new Framework.Data.GeocachingComAccountInfo(); _geocachingComAccount.AccountName = _settingsProvider.GetSettingsValue("Core.GCComAccountName", null); _geocachingComAccount.APIToken = _settingsProvider.GetSettingsValue("Core.GCComAccountToken", null); _geocachingComAccount.APITokenStaging = _settingsProvider.GetSettingsValue("Core.GCComAccountTokenStaging", null); _geocachingComAccount.MemberType = _settingsProvider.GetSettingsValue("Core.GCComAccountMemberType", null); _geocachingComAccount.MemberTypeId = _settingsProvider.GetSettingsValueInt("Core.GCComAccountMemberTypeId", 0); _geocachingComAccount.Changed += new Framework.EventArguments.GeocacheComAccountEventHandler(_geocachingComAccount_Changed); GeocachingAccountNames.SetAccountName("GC", _settingsProvider.GetSettingsValue("Core.GCComAccountName", null) ?? ""); _logs = new Framework.Data.LogCollection(); _userWaypoints = new Framework.Data.UserWaypointCollection(); _waypoints = new Framework.Data.WaypointCollection(); _geocaches = new Framework.Data.GeocacheCollection(this); _logImages = new Framework.Data.LogImageCollection(); _geocacheImages = new Framework.Data.GeocacheImageCollection(); _geocacheAttributes = new Framework.Data.GeocacheAttributeCollection(); _geocacheTypes = new Framework.Data.GeocacheTypeCollection(); _geocacheContainers = new Framework.Data.GeocacheContainerCollection(); _logTypes = new Framework.Data.LogTypeCollection(); _waypointTypes = new Framework.Data.WaypointTypeCollection(); _homeLocation = new Framework.Data.Location(); _centerLocation = new Framework.Data.Location(); _gpsLocation = new Framework.Data.GPSLocation(); _languageItems = new Framework.Data.LanguageItemCollection(); _detectedPlugins = new List <string>(); _internalStoragePlugins = new List <string>(); _selectedLanguage = System.Globalization.CultureInfo.CurrentCulture; _plugins = new List <Framework.Interfaces.IPlugin>(); _currentDomain = AppDomain.CurrentDomain; _currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); //set initial data //default location settings _centerLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.CenterLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.CenterLon", 5.5)); _centerLocation.Changed += new Framework.EventArguments.LocationEventHandler(_centerLocation_Changed); _homeLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.HomeLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.HomeLon", 5.5)); _homeLocation.Changed += new Framework.EventArguments.LocationEventHandler(_homeLocation_Changed); //default (unknown) cache- ,container etc. types. Position 0 means unknown Framework.Data.GeocacheType ct = new Framework.Data.GeocacheType(); ct.ID = 0; ct.Name = "Not present"; _geocacheTypes.Add(ct); Framework.Data.GeocacheAttribute attr = new Framework.Data.GeocacheAttribute(); attr.ID = 0; attr.Name = "Unknown"; _geocacheAttributes.Add(attr); Framework.Data.GeocacheContainer cont = new Framework.Data.GeocacheContainer(); cont.ID = 0; cont.Name = "Unknown"; _geocacheContainers.Add(cont); Framework.Data.LogType lt = new Framework.Data.LogType(); lt.ID = 0; lt.Name = "Unknown"; lt.AsFound = false; _logTypes.Add(lt); Framework.Data.WaypointType wpt = new Framework.Data.WaypointType(); wpt.ID = 0; wpt.Name = "Unknown"; _waypointTypes.Add(wpt); _shortcuts = new List <Framework.Data.ShortcutInfo>(); } } catch { RestoreDefaultSettings(); } }
public string GetImagePath(Framework.Data.ImageSize imageSize, Framework.Data.LogType logType) { return(null); }
private void buttonSubmit_Click(object sender, EventArgs e) { panel1.Enabled = false; panel2.Enabled = false; this.ControlBox = false; _logDate = dateTimePicker1.Value.Date; _logType = (comboBoxLogType1.SelectedItem as Framework.Data.LogType); _tbs75 = (from string a in checkedListBox1.CheckedItems select a.Split(new char[] { ',' }, 2)[0]).ToList(); _logText = textBox2.Text; _foundcount = (int)numericUpDown1.Value; if (checkBox1.Checked) { _gcList = ((from int a in listView1.CheckedIndices orderby a select (Framework.Data.Geocache)listView1.Items[a].Tag).Take(1).ToList()); } else { _gcList = ((from int a in listView1.CheckedIndices orderby a select (Framework.Data.Geocache)listView1.Items[a].Tag).ToList()); } using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(_core)) { _actionReady = new ManualResetEvent(false); Thread thrd = new Thread(new ThreadStart(this.logThreadMethod)); thrd.Start(); while (!_actionReady.WaitOne(100)) { System.Windows.Forms.Application.DoEvents(); } thrd.Join(); _actionReady.Dispose(); _actionReady = null; } if (!string.IsNullOrEmpty(_errormessage)) { System.Windows.Forms.MessageBox.Show(_errormessage, Utils.LanguageSupport.Instance.GetTranslation(Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR)), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } numericUpDown1.Value = _foundcount; panel2.Enabled = true; panel1.Enabled = true; toolStripStatusLabel1.Visible = false; toolStripStatusLabel1.Text = ""; this.ControlBox = true; }
private void button2_Click(object sender, EventArgs e) { this.ControlBox = false; panel1.Enabled = false; buttonCancel.Visible = true; _cancelled = false; _logType = comboBoxLogType1.SelectedItem as Framework.Data.LogType; _visitDate = dateTimePicker1.Value.Date; _logText = textBox2.Text; _gcCode = textBox3.Text.ToUpper().Trim(); _stopAfterEachLog = checkBoxStopAfterEachLog.Checked; _errormessage = null; _tbs = new List<string>(); _tbs.AddRange((from int a in checkedListBox1.CheckedIndices orderby a select (string)checkedListBox1.Items[a]).ToArray()); if (_tbs.Count > 0) { toolStripProgressBar1.Value = 0; toolStripProgressBar1.Maximum = _tbs.Count; _actionReady = new ManualResetEvent(false); Thread thrd = new Thread(new ThreadStart(this.logThreadMethod)); thrd.Start(); while (!_actionReady.WaitOne(100)) { System.Windows.Forms.Application.DoEvents(); } thrd.Join(); if (!string.IsNullOrEmpty(_errormessage)) { System.Windows.Forms.MessageBox.Show(_errormessage, Utils.LanguageSupport.Instance.GetTranslation(Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR)), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } buttonCancel.Visible = false; this.ControlBox = true; panel1.Enabled = true; }
public Engine() { try { _settingsProvider = new SettingsProvider(null); string[] args = Environment.GetCommandLineArgs(); if (EnablePluginDataPathAtStartup || (args != null && args.Contains("/f"))) { using (SelectSettingsForm dlg = new SelectSettingsForm(this)) { _pluginDataFolderSelected = dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK; } } else { _pluginDataFolderSelected = true; } if (_pluginDataFolderSelected) { _geocachingAccountNames = new Framework.Data.GeocachingAccountNames(); var p = _settingsProvider.GetSettingsValueStringCollection("Core.GeocachingAccountNames", null); if (p != null) { foreach (string s in p) { string[] parts = s.Split("|".ToArray(), 2); if (parts.Length == 2) { _geocachingAccountNames.SetAccountName(parts[0], parts[1]); } } } _geocachingAccountNames.Changed += new Framework.EventArguments.GeocachingAccountNamesEventHandler(_geocachingAccountNames_Changed); _geocachingComAccount = new Framework.Data.GeocachingComAccountInfo(); _geocachingComAccount.AccountName = _settingsProvider.GetSettingsValue("Core.GCComAccountName", null); _geocachingComAccount.APIToken = _settingsProvider.GetSettingsValue("Core.GCComAccountToken", null); _geocachingComAccount.APITokenStaging = _settingsProvider.GetSettingsValue("Core.GCComAccountTokenStaging", null); _geocachingComAccount.MemberType = _settingsProvider.GetSettingsValue("Core.GCComAccountMemberType", null); _geocachingComAccount.MemberTypeId = _settingsProvider.GetSettingsValueInt("Core.GCComAccountMemberTypeId", 0); _geocachingComAccount.Changed += new Framework.EventArguments.GeocacheComAccountEventHandler(_geocachingComAccount_Changed); GeocachingAccountNames.SetAccountName("GC", _settingsProvider.GetSettingsValue("Core.GCComAccountName", null) ?? ""); _logs = new Framework.Data.LogCollection(); _userWaypoints = new Framework.Data.UserWaypointCollection(); _waypoints = new Framework.Data.WaypointCollection(); _geocaches = new Framework.Data.GeocacheCollection(this); _logImages = new Framework.Data.LogImageCollection(); _geocacheImages = new Framework.Data.GeocacheImageCollection(); _geocacheAttributes = new Framework.Data.GeocacheAttributeCollection(); _geocacheTypes = new Framework.Data.GeocacheTypeCollection(); _geocacheContainers = new Framework.Data.GeocacheContainerCollection(); _logTypes = new Framework.Data.LogTypeCollection(); _waypointTypes = new Framework.Data.WaypointTypeCollection(); _homeLocation = new Framework.Data.Location(); _centerLocation = new Framework.Data.Location(); _gpsLocation = new Framework.Data.GPSLocation(); _languageItems = new Framework.Data.LanguageItemCollection(); _detectedPlugins = new List<string>(); _internalStoragePlugins = new List<string>(); _selectedLanguage = System.Globalization.CultureInfo.CurrentCulture; _plugins = new List<Framework.Interfaces.IPlugin>(); _currentDomain = AppDomain.CurrentDomain; _currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); //set initial data //default location settings _centerLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.CenterLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.CenterLon", 5.5)); _centerLocation.Changed += new Framework.EventArguments.LocationEventHandler(_centerLocation_Changed); _homeLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.HomeLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.HomeLon", 5.5)); _homeLocation.Changed += new Framework.EventArguments.LocationEventHandler(_homeLocation_Changed); //default (unknown) cache- ,container etc. types. Position 0 means unknown Framework.Data.GeocacheType ct = new Framework.Data.GeocacheType(); ct.ID = 0; ct.Name = "Not present"; _geocacheTypes.Add(ct); Framework.Data.GeocacheAttribute attr = new Framework.Data.GeocacheAttribute(); attr.ID = 0; attr.Name = "Unknown"; _geocacheAttributes.Add(attr); Framework.Data.GeocacheContainer cont = new Framework.Data.GeocacheContainer(); cont.ID = 0; cont.Name = "Unknown"; _geocacheContainers.Add(cont); Framework.Data.LogType lt = new Framework.Data.LogType(); lt.ID = 0; lt.Name = "Unknown"; lt.AsFound = false; _logTypes.Add(lt); Framework.Data.WaypointType wpt = new Framework.Data.WaypointType(); wpt.ID = 0; wpt.Name = "Unknown"; _waypointTypes.Add(wpt); _shortcuts = new List<Framework.Data.ShortcutInfo>(); } } catch { RestoreDefaultSettings(); } }