Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefangansevles committed Aug 14, 2021
1 parent 006bc94 commit ed14b4b
Show file tree
Hide file tree
Showing 32 changed files with 254 additions and 110 deletions.
1 change: 0 additions & 1 deletion Business Logic Layer/BLIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public static int DumpLogTxt()
{
try
{

Directory.CreateDirectory(Path.GetDirectoryName(IOVariables.systemLog));

File.WriteAllText(IOVariables.systemLog, ""); //Clear log
Expand Down
4 changes: 2 additions & 2 deletions Business Logic Layer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,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("2.5.0")]
[assembly: AssemblyFileVersion("2.5.0")]
[assembly: AssemblyVersion("2.5.1")]
[assembly: AssemblyFileVersion("2.5.1")]
Binary file not shown.
3 changes: 2 additions & 1 deletion Data Access Layer/DLDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private DLDatabase() { }
private const string TABLE_REMINDER = "CREATE TABLE [Reminder] ([Id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [Deleted] bigint DEFAULT(0) NOT NULL, [Name] text NOT NULL, [Date] text NOT NULL, [RepeatType] text NOT NULL, [Note] text NOT NULL, [Enabled] bigint NOT NULL, [DayOfMonth]bigint NULL, [EveryXCustom] bigint NULL, [RepeatDays] text NULL, [SoundFilePath] text NULL, [PostponeDate] text NULL, [Hide] bigint DEFAULT(0) NULL, [Corrupted] bigint DEFAULT(0) NULL, [EnableAdvancedReminder] bigint DEFAULT(1) NOT NULL, [UpdateTime] bigint DEFAULT(0) NOT NULL);";

//The neccesary query to execute to create the table Settings
private const string TABLE_SETTINGS = "CREATE TABLE [Settings] ([Id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [AlwaysOnTop] bigint NOT NULL, [StickyForm] bigint NOT NULL, [EnableReminderCountPopup] bigint DEFAULT(1) NOT NULL, [EnableHourBeforeReminder] bigint DEFAULT(1) NOT NULL, [HideReminderConfirmation] bigint DEFAULT(0) NULL, [EnableQuickTimer] bigint DEFAULT(1) NOT NULL, [LastVersion] text NULL, [DefaultTimerSound] text NULL, [EnableAdvancedReminders] bigint NULL, [UniqueString] text NULL, [RemindMeTheme] text DEFAULT('Default') NOT NULL, [DrawerUseColors] bigint DEFAULT(0) NULL, [DrawerHighlight] bigint DEFAULT(1) NULL, [DrawerBackground] bigint DEFAULT(0) NULL, [CurrentTheme] bigint DEFAULT(-1) NULL, [MaterialDesign] bigint DEFAULT(1) NULL, [AutoUpdate] bigint DEFAULT (1) NOT NULL);";
private const string TABLE_SETTINGS = "CREATE TABLE [Settings] ([Id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [AlwaysOnTop] bigint NOT NULL, [StickyForm] bigint NOT NULL, [EnableReminderCountPopup] bigint DEFAULT(1) NOT NULL, [EnableHourBeforeReminder] bigint DEFAULT(1) NOT NULL, [HideReminderConfirmation] bigint DEFAULT(0) NULL, [EnableQuickTimer] bigint DEFAULT(1) NOT NULL, [LastVersion] text NULL, [DefaultTimerSound] text NULL, [EnableAdvancedReminders] bigint NULL, [UniqueString] text NULL, [RemindMeTheme] text DEFAULT('Default') NOT NULL, [DrawerUseColors] bigint DEFAULT(0) NULL, [DrawerHighlight] bigint DEFAULT(1) NULL, [DrawerBackground] bigint DEFAULT(0) NULL, [CurrentTheme] bigint DEFAULT(-1) NULL, [MaterialDesign] bigint DEFAULT(1) NULL, [AutoUpdate] bigint DEFAULT(1) NOT NULL, [TimerVolume] bigint DEFAULT(100) NOT NULL);";

//The neccesary query to execute to create the table Songs
private const string TABLE_SONGS = "CREATE TABLE [Songs] ( [Id] INTEGER NOT NULL, [SongFileName]text NOT NULL, [SongFilePath]text NOT NULL, CONSTRAINT[sqlite_master_PK_Songs] PRIMARY KEY([Id]));";
Expand Down Expand Up @@ -595,6 +595,7 @@ private static string GetSettingColumnSqlType(string columnName)
case "MaterialDesign": return "bigint DEFAULT 1 NULL";
case "IsDefault": return "bigint DEFAULT 0 NOT NULL";
case "AutoUpdate": return "bigint DEFAULT 1 NOT NULL";
case "TimerVolume": return "bigint DEFAULT 100 NOT NULL";
default: return "text NULL";
}
}
Expand Down
1 change: 1 addition & 0 deletions Data Access Layer/DLLocalDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ private static void RefreshSettings()
settings.EnableAdvancedReminders = 0;
settings.RemindMeTheme = "Default";
settings.AutoUpdate = 1;
settings.TimerVolume = 100;
UpdateSettings(settings);
}
else
Expand Down
4 changes: 2 additions & 2 deletions Data Access Layer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,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("2.4.6")]
[assembly: AssemblyFileVersion("2.4.6")]
[assembly: AssemblyVersion("2.4.7")]
[assembly: AssemblyFileVersion("2.4.7")]
3 changes: 3 additions & 0 deletions Data Access Layer/RemindMeDb.edmx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<Property Name="CurrentTheme" Type="integer" />
<Property Name="MaterialDesign" Type="integer" />
<Property Name="AutoUpdate" Type="integer" Nullable="false" />
<Property Name="TimerVolume" Type="integer" Nullable="false" />
</EntityType>
<EntityType Name="Songs">
<Key>
Expand Down Expand Up @@ -232,6 +233,7 @@
<Property Name="CurrentTheme" Type="Int64" />
<Property Name="MaterialDesign" Type="Int64" />
<Property Name="AutoUpdate" Type="Int64" Nullable="false" />
<Property Name="TimerVolume" Type="Int64" Nullable="false" />
</EntityType>
<EntityType Name="Songs">
<Key>
Expand Down Expand Up @@ -399,6 +401,7 @@
<EntitySetMapping Name="Settings">
<EntityTypeMapping TypeName="RemindMeDatabaseModel.Settings">
<MappingFragment StoreEntitySet="Settings">
<ScalarProperty Name="TimerVolume" ColumnName="TimerVolume" />
<ScalarProperty Name="AutoUpdate" ColumnName="AutoUpdate" />
<ScalarProperty Name="MaterialDesign" ColumnName="MaterialDesign" />
<ScalarProperty Name="CurrentTheme" ColumnName="CurrentTheme" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<Property Name="CurrentTheme" Type="Int64" />
<Property Name="MaterialDesign" Type="Int64" />
<Property Name="AutoUpdate" Type="Int64" Nullable="false" />
<Property Name="TimerVolume" Type="Int64" Nullable="false" />
</EntityType>
<EntityType Name="Songs">
<Key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<EntitySetMapping Name="Settings">
<EntityTypeMapping TypeName="RemindMeDatabaseModel.Settings">
<MappingFragment StoreEntitySet="Settings">
<ScalarProperty Name="TimerVolume" ColumnName="TimerVolume" />
<ScalarProperty Name="AutoUpdate" ColumnName="AutoUpdate" />
<ScalarProperty Name="MaterialDesign" ColumnName="MaterialDesign" />
<ScalarProperty Name="CurrentTheme" ColumnName="CurrentTheme" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<Property Name="CurrentTheme" Type="integer" />
<Property Name="MaterialDesign" Type="integer" />
<Property Name="AutoUpdate" Type="integer" Nullable="false" />
<Property Name="TimerVolume" Type="integer" Nullable="false" />
</EntityType>
<EntityType Name="Songs">
<Key>
Expand Down
1 change: 1 addition & 0 deletions Database.Entity/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ public partial class Settings
public Nullable<long> CurrentTheme { get; set; }
public Nullable<long> MaterialDesign { get; set; }
public long AutoUpdate { get; set; }
public long TimerVolume { get; set; }
}
}
14 changes: 14 additions & 0 deletions How to: Advanced Reminders.md → How to Advanced Reminders.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ Conditional reminders are loaded into the list after normal reminders, so you mi

Looping over arrays inside a JSON API response is not yet implemented. This might get implemented in the future.

### Also...

It is also possible to show the API data in an reminder's note text. You can do this by including ```API{url,path}``` in the reminder's note. For example:

```API{https://prices.runescape.wiki/api/v1/osrs/latest?id=9050,data.9050.low}``` This will call the api, and display the data ```data.9050.low```

To show some examples, see the following screenshot (Edit mode)

<img src="https://i.imgur.com/XDLsXSG.png" width="50%"></img>

This will result in:

<img src="https://i.imgur.com/0cOmeWY.png" width="50%"></img>

### Note

The "hide reminder" function from the "batch" tab will also work in combination with API reminders. Once the API condition has been met, you can configure it to execute the batch
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions RemindMe/Forms/MaterialForms/MaterialForm1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,15 @@ private void MaterialForm1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
shouldClose = false;
return;
}
}

//Makes the mouseclick a little bit less laggy
new Thread(() =>
{
Environment.Exit(0);
}).Start();
}

private void tmrCheckRemindMeMessages_Tick(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions RemindMe/Forms/MaterialForms/MaterialPopup.Designer.cs

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

47 changes: 42 additions & 5 deletions RemindMe/Forms/MaterialForms/MaterialPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,32 @@ private async void TransformAPITextToValue(string color, string reminderText, fl

try
{
//if !hasinternetaccess Thread.Sleep(250); , 8 times, then error

if(!BLIO.HasInternetAccess())
{
retryCount++;

if (retryCount <= 8)
{
Thread.Sleep(250);
goto startMethod;
}
else
{
htmlLblText.Invoke((MethodInvoker)(() =>
{
htmlLblText.Text = "An error occured." + rem.Note;
}));

return;
}
}

retryCount = 0;

//Interner access!

int startIndex = reminderText.IndexOf("API{");
int endIndex = -1;

Expand All @@ -135,7 +161,7 @@ private async void TransformAPITextToValue(string color, string reminderText, fl
//[url, dataToPick]
string[] data = (reminderText.Substring(startIndex + 4, endIndex - (startIndex + 4))).Split(',');
JObject response = await BLIO.HttpRequest("GET", data[0]);

//This is the API value the user is requesting. Replace API{url,data} with this.
string value = response.SelectTokens(data[1]).Select(t => t.Value<string>()).ToList()[0];

Expand All @@ -144,7 +170,11 @@ private async void TransformAPITextToValue(string color, string reminderText, fl
stringBuilder.Insert(startIndex, value);
reminderText = stringBuilder.ToString();


//TODO if response.status != 200 stringBuilder.Insert(startIndex, "Error occured");
//Bitcoin: $60,001
//Superfarm: Error
//Reef: $0,04
//

//Still contains another API{} ? again...
if (reminderText.Contains("API{"))
Expand All @@ -156,14 +186,17 @@ private async void TransformAPITextToValue(string color, string reminderText, fl
}));
//return reminderText;
}
catch
catch (Exception ex)
{
retryCount++;

if (retryCount <= 8)
{
Thread.Sleep(250);
goto startMethod;
} else
{
htmlLblText.Text = "An error occured. (" + ex.GetType().ToString() + ")\r\n" + rem.Note;
}
}

Expand Down Expand Up @@ -236,7 +269,7 @@ public void ChangeFontSize(float size)
}


private async void Popup2_Load(object sender, EventArgs e)
private void Popup_Load(object sender, EventArgs e)
{
try
{
Expand Down Expand Up @@ -343,6 +376,10 @@ private async void Popup2_Load(object sender, EventArgs e)
{
BLIO.Log("SoundFilePath not null / empty and exists on the hard drive!");
myPlayer.URL = rem.SoundFilePath;

if (rem.Id == -1) //timer, set the volume set by the user
myPlayer.settings.volume = (int)BLLocalDatabase.Setting.Settings.TimerVolume;

myPlayer.controls.play();
BLIO.Log("Playing sound");
}
Expand Down Expand Up @@ -421,7 +458,7 @@ private void numPostponeTime_ValueChanged(object sender, EventArgs e)

}

private void Popup2_SizeChanged(object sender, EventArgs e)
private void Popup_SizeChanged(object sender, EventArgs e)
{
RepositionControls();
var test = this.Height - (this.StatusBarHeight + this.ActionBarHeight);
Expand Down
11 changes: 0 additions & 11 deletions RemindMe/Forms/MaterialForms/MaterialRemindMePrompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ public MaterialRemindMePrompt(string title, PromptReason reason)
this.Text = title;


//Set the location within the remindme window.
//This prompt can be moved, but inititally will be set to the middle of the location of RemindMe
/*Form1 remindme = (Form1)Application.OpenForms["Form1"];
if (remindme != null && remindme.Visible)
{
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(remindme.Location.X + ((remindme.Width / 2) - this.Width / 2), remindme.Location.Y + ((remindme.Height / 2) - (this.Height / 2)));
}
else
this.StartPosition = FormStartPosition.CenterScreen;*/

tmrFadeIn.Start();

strReturnValue = "";
Expand Down
13 changes: 13 additions & 0 deletions RemindMe/Forms/MaterialForms/MaterialTimerPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,21 @@ public MaterialTimerPopup()
MaterialSkin.MaterialSkinManager.Instance.AddFormToManage(this);

InitializeComponent();

instance = this;
this.Opacity = 0;

//Set the location within the remindme window.
//This prompt can be moved, but inititally will be set to the middle of the location of RemindMe
MaterialForm1 remindme = (MaterialForm1)Application.OpenForms["MaterialForm1"];
if (remindme != null && remindme.Visible)
{
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(remindme.Location.X + ((remindme.Width / 2) - this.Width / 2), remindme.Location.Y + ((remindme.Height / 2) - (this.Height / 2)));
}
else
this.StartPosition = FormStartPosition.CenterScreen;

tmrFadeIn.Start();
tbTime.KeyUp += TimerPopup_KeyUp;
tbNote.KeyUp += TimerPopup_KeyUp;
Expand Down
1 change: 1 addition & 0 deletions RemindMe/Other classes/MaterialMessageFormManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static void MakeMessagePopup(string message, int popDelay, string title =
public static void MakeMessagePopup(string message, int popDelay, Reminder rem)
{
RemindMeMaterialMessageForm popupForm = new RemindMeMaterialMessageForm(message, popDelay, rem);
MaterialSkin.MaterialSkinManager.Instance.AddFormToManage(popupForm);
popupForm.Show();

popupForms.Add(popupForm); //Add the popupform
Expand Down
1 change: 1 addition & 0 deletions RemindMe/Other classes/UpdateInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public static void Initialize()
releaseNotes.Add("3.1.01", "- Fixed a bug where sometimes you would not be able to edit an existing reminder\r\n- Improved performance of RemindMe after using RemindMe for a while\r\n-When creating \"Set dates\" reminders, RemindMe will now only automatically add the selected date if the list of added dates is empty. ");
releaseNotes.Add("3.1.04", "- Attempt on bugfix \"80040154 Class not registered\"");
releaseNotes.Add("3.1.05", "- The selected sound(when creating a new reminder) now properly resets to nothing selected.\r\n- Attempted to improve the forcing of getting input focus on timer popups\r\n- Fixed a bug where duplicating a normal reminder would still work, but it would throw an error\r\n- new advanced feature to display api data in a reminder's note(for details, see github)");
releaseNotes.Add("3.1.06", "- You can now change the volume of the timer sound effect by going into the settings(where you set the timer sound effect)\r\n- Fixed the popup location of the RemindMe prompt & changed the popup location for the Timer popup if RemindMe is visible");
}

public static Dictionary<string,string> ReleaseNotes
Expand Down
4 changes: 2 additions & 2 deletions RemindMe/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// 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("3.1.05")]
[assembly: AssemblyFileVersion("3.1.05")]
[assembly: AssemblyVersion("3.1.06")]
[assembly: AssemblyFileVersion("3.1.06")]
[assembly: NeutralResourcesLanguage("en")]
Loading

0 comments on commit ed14b4b

Please sign in to comment.