Skip to content

Commit

Permalink
More fixes, but shared folder doesn't aseem to work
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Wennergren committed Sep 27, 2017
1 parent 0ed0e5d commit 97967e7
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 10 deletions.
25 changes: 21 additions & 4 deletions ATray/Dialogs/ActivityHistoryForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ private void InitHistoryDropDown()
{
// Check what files exists
var rawMonths = ActivityManager.ListAvailableMonths();
if (rawMonths.Count == 0)
{
MessageBox.Show("No history to show!");
Close();
return;
}

var months = rawMonths.Select(x => Tuple.Create(x.Key, new DateTime(x.Key / 100, x.Key % 100, 1).ToString("MMMM yyyy"))).ToList();
monthDropDown.ValueMember = "item1";
monthDropDown.DisplayMember = "item2";
monthDropDown.DataSource = months;
monthDropDown.SelectedValue = rawMonths.Keys.Last();
monthDropDown.SelectedValue = rawMonths.Keys.LastOrDefault();

nextMonthButton.Enabled = false;
lastMonthButton.Enabled = rawMonths.Count > 1;
Expand Down Expand Up @@ -224,14 +230,14 @@ private void ActivityHistoryForm_Paint(object sender, PaintEventArgs e)

// Create a new bitmap that is as wide as the windows and as high as it needs to be to fit all days
var width = ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth;
var height = history.Days.Count * (GraphHeight + GraphSpacing);
var height = history.Days.Count * (GraphHeight + GraphSpacing) + GraphSpacing;

// Only create a new Bitmap if needed
Bitmap lastHistoryGraph = null;
if (_historyGraph == null || width != _historyGraph.Width || height != _historyGraph.Height)
{
lastHistoryGraph = _historyGraph;
_historyGraph = new Bitmap( width,height,System.Drawing.Imaging.PixelFormat.Format24bppRgb);
_historyGraph = new Bitmap(width, height, PixelFormat.Format24bppRgb);
_historyGraph.MakeTransparent();
}

Expand All @@ -245,7 +251,7 @@ private void ActivityHistoryForm_Paint(object sender, PaintEventArgs e)
historyPicture.Controls.Add(label);
var pos = i % 4;
int y = GraphSpacing + (i/4)*(GraphSpacing + GraphHeight);
label.Location = new Point(pos<2?0: width - TimeLabelWidth, y+( pos ==0||pos==3?0:20));
label.Location = new Point(pos < 2 ? 0 : width - TimeLabelWidth, y + (pos == 0 || pos == 3 ? 0 : 20));
_timeLabels.Add(label);
}

Expand All @@ -258,7 +264,9 @@ private void ActivityHistoryForm_Paint(object sender, PaintEventArgs e)

_timeLabels[index++].Text = new DateTime(history.Year, history.Month, dayNumber).DayOfWeek + " " + dayNumber + "/" + history.Month;
_timeLabels[index++].Text = SecondToTime(todaysFirstSecond);
_timeLabels[index].Location = new Point(width - TimeLabelWidth, _timeLabels[index].Location.Y);
_timeLabels[index++].Text = SecondToTime(todaysLastSecond);
_timeLabels[index].Location = new Point(width - TimeLabelWidth, _timeLabels[index].Location.Y);
_timeLabels[index++].Text = "("+ SecondToTime(todaysLastSecond - todaysFirstSecond)+")";
}

Expand Down Expand Up @@ -323,5 +331,14 @@ private void nextMonthButton_Click(object sender, EventArgs e)

monthDropDown.SelectedValue = nextMonth;
}

protected override Point ScrollToControl(Control activeControl)
{
// Returning the current location prevents the panel from
// scrolling to the active control when the panel loses and regains focus
//return this.DisplayRectangle.Location;

return base.ScrollToControl(activeControl);
}
}
}
16 changes: 13 additions & 3 deletions ATray/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class Program
internal static RepositoryCollection Repositories;
internal static Configuration Configuration;
internal static MainWindow MainWindowInstance;
internal static Task UpdateTask = null;

/// <summary>
/// The main entry point for the application.
Expand All @@ -48,7 +49,7 @@ public static void Main()
Repositories = new RepositoryCollection(RepoListFilePath);
Configuration = new Configuration(ConfigurationFilePath);

var updateTask = Task.Run(CheckForUpdates);
UpdateTask = Task.Run(CheckForUpdates);

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Expand All @@ -63,8 +64,17 @@ private static async Task CheckForUpdates()
using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/jokedst/ATray"))
{
var manager = await mgr;
var up = await manager.UpdateApp();
Trace.TraceInformation("Update check " + up.Version);
var upOrNot = await manager.CheckForUpdate();
if (upOrNot != null && upOrNot.ReleasesToApply.Count > 0)
{
var result = MessageBox.Show("An update is available. Do you want to update?", "UPDATE!", MessageBoxButtons.OKCancel);
if (result == DialogResult.OK)
{
var up = await manager.UpdateApp();
Trace.TraceInformation("Update check " + up.Version);
}
}
manager.Dispose();
}
}
catch (Exception e)
Expand Down
4 changes: 2 additions & 2 deletions ATray/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyVersion("1.0.5.0")]
[assembly: AssemblyFileVersion("1.0.5.0")]
Binary file added ATray/Releases/ATray-1.0.5-delta.nupkg
Binary file not shown.
Binary file added ATray/Releases/ATray-1.0.5-full.nupkg
Binary file not shown.
4 changes: 3 additions & 1 deletion ATray/Releases/RELEASES
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
AB5648C57EF494015F21EA4F9FA1D0B247A9CAB3 ATray-1.0.3-delta.nupkg 25956
455290875BE4ADF1DBE1D4C455321CFA28AE5F0B ATray-1.0.3-full.nupkg 7106412
7179D5D3D1C4A28674846F914D4EE9AC167A04DA ATray-1.0.4-delta.nupkg 41397
046A4A3BD8C62128787C924621D8EAB3AAD80BC3 ATray-1.0.4-full.nupkg 7107646
046A4A3BD8C62128787C924621D8EAB3AAD80BC3 ATray-1.0.4-full.nupkg 7107646
AD29B90CB6A8CFCD811878B3B4EDD026EC9BDEBB ATray-1.0.5-delta.nupkg 47696
178264C75DC02CDC4A58693508902D13AFC81330 ATray-1.0.5-full.nupkg 7109920
Binary file modified ATray/Releases/Setup.exe
Binary file not shown.
Binary file modified ATray/Releases/Setup.msi
Binary file not shown.
Loading

0 comments on commit 97967e7

Please sign in to comment.