Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
update textbox selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjorn committed Aug 10, 2016
1 parent 32b7552 commit bfd006d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
9 changes: 6 additions & 3 deletions FloatingGlucose/FloatingGlucose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private async void LoadGlucoseValue()
{
WriteDebug("Trying to refresh data");
//var data = await this.GetNightscoutPebbleDataAsync(nsURL + "/pebble");
var data = await PebbleData.GetNightscoutPebbleDataAsync(nsURL + "/pebble");
var data = await PebbleData.GetNightscoutPebbleDataAsync(this.nsURL + "/pebble");
this.lblGlucoseValue.Text = String.Format("{0} {1}", data.glucose, data.directionArrow);
var status = GlucoseStatus.GetGlucoseStatus(data.glucose);

Expand Down Expand Up @@ -226,7 +226,11 @@ private async void LoadGlucoseValue()

private void FloatingGlucose_Load(object sender, EventArgs e)
{

if (this.settingsForm == null || this.settingsForm.IsDisposed)
{
this.settingsForm = new FormGlucoseSettings();
}

if (!Validators.isUrl(this.nsURL)) {
this.settingsForm.ShowDialog();

Expand All @@ -236,7 +240,6 @@ private void FloatingGlucose_Load(object sender, EventArgs e)

var refreshGlucoseTimer = new System.Windows.Forms.Timer();
//auto refresh data once every x seconds

refreshGlucoseTimer.Interval = this.refreshTime;
refreshGlucoseTimer.Tick += new EventHandler(Glucose_Tick);
refreshGlucoseTimer.Start();
Expand Down
43 changes: 22 additions & 21 deletions FloatingGlucose/FormGlucoseSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions FloatingGlucose/FormGlucoseSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ public FormGlucoseSettings()

private void txtNSURL_GotFocus(object sender, EventArgs e)
{
if (this.txtNSURL.Text == "https://mysite.azurewebsites.net")
var colonPartPos = this.txtNSURL.Text.IndexOf("://");
var azurePartPos = this.txtNSURL.Text.IndexOf(".azurewebsites.net");
if(colonPartPos != -1 && azurePartPos != -1 && colonPartPos < azurePartPos)
{
this.txtNSURL.Select(8, 6);
}
this.txtNSURL.Select(colonPartPos+3, azurePartPos-colonPartPos-3);
}

}
private void txtNSURL_LostFocus(object sender, EventArgs e)
Expand Down

0 comments on commit bfd006d

Please sign in to comment.