Made it so if we crash we can tell.
Made it so if we know we crashed we disable the 3d display o gcode (just in case). We can make more crash recovery now as well.
This commit is contained in:
parent
1697622477
commit
f788ccb6cd
8 changed files with 51 additions and 101 deletions
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2014, Lars Brubaker
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
The views and conclusions contained in the software and documentation are those
|
|
||||||
of the authors and should not be interpreted as representing official policies,
|
|
||||||
either expressed or implied, of the FreeBSD Project.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define USE_CRASH_TRACKER
|
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
using MatterHackers.MatterControl.DataStorage;
|
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl
|
|
||||||
{
|
|
||||||
public static class CrashTracker
|
|
||||||
{
|
|
||||||
static string outputFilename;
|
|
||||||
public static void Reset()
|
|
||||||
{
|
|
||||||
outputFilename = Path.Combine(DataStorage.ApplicationDataStorage.Instance.ApplicationUserDataPath, "CrashTracker.txt");
|
|
||||||
|
|
||||||
#if USE_CRASH_TRACKER
|
|
||||||
// Create the file to clear its contents
|
|
||||||
using (StreamWriter sw = File.CreateText(outputFilename))
|
|
||||||
{
|
|
||||||
sw.WriteLine("Hello");
|
|
||||||
sw.WriteLine("And");
|
|
||||||
sw.WriteLine("Welcome");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Write(string info)
|
|
||||||
{
|
|
||||||
#if USE_CRASH_TRACKER
|
|
||||||
using (StreamWriter sw = File.AppendText(outputFilename))
|
|
||||||
{
|
|
||||||
sw.WriteLine(info);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -119,7 +119,6 @@
|
||||||
<Compile Include="ConfigurationPage\PrintLeveling\PrintLevelingData.cs" />
|
<Compile Include="ConfigurationPage\PrintLeveling\PrintLevelingData.cs" />
|
||||||
<Compile Include="ConfigurationPage\SettingsViewBase.cs" />
|
<Compile Include="ConfigurationPage\SettingsViewBase.cs" />
|
||||||
<Compile Include="ControlElements\ConditionalClickWidget.cs" />
|
<Compile Include="ControlElements\ConditionalClickWidget.cs" />
|
||||||
<Compile Include="CrashTracker.cs" />
|
|
||||||
<Compile Include="CustomWidgets\AltGroupBox.cs" />
|
<Compile Include="CustomWidgets\AltGroupBox.cs" />
|
||||||
<Compile Include="CustomWidgets\DoubleSolidSlider.cs" />
|
<Compile Include="CustomWidgets\DoubleSolidSlider.cs" />
|
||||||
<Compile Include="CustomWidgets\FatFlatClickWidget.cs" />
|
<Compile Include="CustomWidgets\FatFlatClickWidget.cs" />
|
||||||
|
|
|
||||||
|
|
@ -625,11 +625,10 @@ Global
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug|x64.Build.0 = Debug|Any CPU
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|Any CPU.ActiveCfg = Debug64|x64
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|Any CPU.Build.0 = Debug64|x64
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|x64.ActiveCfg = Debug64|x64
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|x64.ActiveCfg = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|x64.Build.0 = Debug64|x64
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|x86.ActiveCfg = Debug|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Debug64|x86.ActiveCfg = Debug64|x64
|
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Release|x64.ActiveCfg = Release|Any CPU
|
{6782BF37-8139-4DC6-885E-98D22D1FB258}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ namespace MatterHackers.MatterControl
|
||||||
public MatterControlApplication(double width, double height)
|
public MatterControlApplication(double width, double height)
|
||||||
: base(width, height)
|
: base(width, height)
|
||||||
{
|
{
|
||||||
CrashTracker.Reset();
|
// set this at startup so that we can tell next time if it got set to true in close
|
||||||
|
UserSettings.Instance.Fields.StartCount = UserSettings.Instance.Fields.StartCount + 1;
|
||||||
|
|
||||||
this.commandLineArgs = Environment.GetCommandLineArgs();
|
this.commandLineArgs = Environment.GetCommandLineArgs();
|
||||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
|
@ -174,12 +175,9 @@ namespace MatterHackers.MatterControl
|
||||||
DesktopPosition = new Point2D(xpos, ypos);
|
DesktopPosition = new Point2D(xpos, ypos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure when we start up that we are showing the 3D view
|
// make sure when we start up, we are not showing the 3D view
|
||||||
UserSettings.Instance.Fields.EmbededViewShowingGCode = false;
|
UserSettings.Instance.Fields.EmbededViewShowingGCode = false;
|
||||||
|
|
||||||
// set this at startup so that we can tell next time if it got set to true in close
|
|
||||||
UserSettings.Instance.Fields.AppExitedNormaly = false;
|
|
||||||
|
|
||||||
ShowAsSystemWindow();
|
ShowAsSystemWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -370,7 +368,8 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
public override void OnClosed(EventArgs e)
|
public override void OnClosed(EventArgs e)
|
||||||
{
|
{
|
||||||
UserSettings.Instance.Fields.AppExitedNormaly = true;
|
UserSettings.Instance.Fields.StartCountDurringExit = UserSettings.Instance.Fields.StartCount;
|
||||||
|
|
||||||
TerminalWindow.CloseIfOpen();
|
TerminalWindow.CloseIfOpen();
|
||||||
PrinterConnectionAndCommunication.Instance.Disable();
|
PrinterConnectionAndCommunication.Instance.Disable();
|
||||||
//Close connection to the local datastore
|
//Close connection to the local datastore
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
AddChild(threeDimensionButton);
|
AddChild(threeDimensionButton);
|
||||||
|
|
||||||
if (UserSettings.Instance.get("LayerViewDefault") == "3D Layer"
|
if (UserSettings.Instance.get("LayerViewDefault") == "3D Layer"
|
||||||
&& UserSettings.Instance.Fields.AppExitedNormaly == true)
|
&& UserSettings.Instance.Fields.StartCountDurringExit == UserSettings.Instance.Fields.StartCount - 1)
|
||||||
{
|
{
|
||||||
threeDimensionButton.Checked = true;
|
threeDimensionButton.Checked = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ namespace MatterHackers.MatterControl
|
||||||
textScrollWidget.SetLineStartFilter(null);
|
textScrollWidget.SetLineStartFilter(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserSettings.Instance.Fields.SetValue(TerminalFilterOutputKey, filterOutput.Checked);
|
UserSettings.Instance.Fields.SetBool(TerminalFilterOutputKey, filterOutput.Checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
filterOutput.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
filterOutput.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
||||||
|
|
@ -98,13 +98,13 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
autoUppercase = new CheckBox(autoUpperCaseChkTxt);
|
autoUppercase = new CheckBox(autoUpperCaseChkTxt);
|
||||||
autoUppercase.Margin = new BorderDouble(5, 5, 5, 2);
|
autoUppercase.Margin = new BorderDouble(5, 5, 5, 2);
|
||||||
autoUppercase.Checked = UserSettings.Instance.Fields.GetValue(TerminalAutoUppercaseKey, true);
|
autoUppercase.Checked = UserSettings.Instance.Fields.GetBool(TerminalAutoUppercaseKey, true);
|
||||||
autoUppercase.TextColor = this.textColor;
|
autoUppercase.TextColor = this.textColor;
|
||||||
autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
autoUppercase.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
||||||
topBarControls.AddChild(autoUppercase);
|
topBarControls.AddChild(autoUppercase);
|
||||||
autoUppercase.CheckedStateChanged += (sender, e) =>
|
autoUppercase.CheckedStateChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
UserSettings.Instance.Fields.SetValue(TerminalAutoUppercaseKey, autoUppercase.Checked);
|
UserSettings.Instance.Fields.SetBool(TerminalAutoUppercaseKey, autoUppercase.Checked);
|
||||||
};
|
};
|
||||||
manualEntryTopToBottomLayout.AddChild(topBarControls);
|
manualEntryTopToBottomLayout.AddChild(topBarControls);
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +209,7 @@ namespace MatterHackers.MatterControl
|
||||||
{
|
{
|
||||||
if (firstDraw)
|
if (firstDraw)
|
||||||
{
|
{
|
||||||
filterOutput.Checked = UserSettings.Instance.Fields.GetValue(TerminalFilterOutputKey, false);
|
filterOutput.Checked = UserSettings.Instance.Fields.GetBool(TerminalFilterOutputKey, false);
|
||||||
firstDraw = false;
|
firstDraw = false;
|
||||||
}
|
}
|
||||||
base.OnDraw(graphics2D);
|
base.OnDraw(graphics2D);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl
|
||||||
};
|
};
|
||||||
|
|
||||||
// start with the assumption we are open and only change this is we see it close
|
// start with the assumption we are open and only change this is we see it close
|
||||||
UserSettings.Instance.Fields.SetValue(TerminalWindowLeftOpen, true);
|
UserSettings.Instance.Fields.SetBool(TerminalWindowLeftOpen, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
public static void ShowIfLeftOpen()
|
public static void ShowIfLeftOpen()
|
||||||
{
|
{
|
||||||
if (UserSettings.Instance.Fields.GetValue(TerminalWindowLeftOpen, false))
|
if (UserSettings.Instance.Fields.GetBool(TerminalWindowLeftOpen, false))
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +122,7 @@ namespace MatterHackers.MatterControl
|
||||||
public override void OnClosed(EventArgs e)
|
public override void OnClosed(EventArgs e)
|
||||||
{
|
{
|
||||||
SaveOnClosing();
|
SaveOnClosing();
|
||||||
UserSettings.Instance.Fields.SetValue(TerminalWindowLeftOpen, terminalWasOpenOnAppClose);
|
UserSettings.Instance.Fields.SetBool(TerminalWindowLeftOpen, terminalWasOpenOnAppClose);
|
||||||
|
|
||||||
base.OnClosed(e);
|
base.OnClosed(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,50 +40,51 @@ namespace MatterHackers.MatterControl
|
||||||
{
|
{
|
||||||
List<string> acceptableTrueFalseValues = new List<string>() { "true", "false" };
|
List<string> acceptableTrueFalseValues = new List<string>() { "true", "false" };
|
||||||
|
|
||||||
|
string StartCountKey = "StartCount";
|
||||||
|
string StartCountDurringExitKey = "StartCountDurringExit";
|
||||||
|
|
||||||
string IsSimpleModeKey = "IsSimpleMode";
|
string IsSimpleModeKey = "IsSimpleMode";
|
||||||
string EmbededViewShowingGCodeKey = "EmbededViewShowingGCode";
|
string EmbededViewShowingGCodeKey = "EmbededViewShowingGCode";
|
||||||
string AppExitedNormalyKey = "ExitedNormaly";
|
|
||||||
|
|
||||||
public bool IsSimpleMode
|
public bool IsSimpleMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return GetValue(IsSimpleModeKey, OemSettings.Instance.UseSimpleModeByDefault);
|
return GetBool(IsSimpleModeKey, OemSettings.Instance.UseSimpleModeByDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetValue(IsSimpleModeKey, value);
|
SetBool(IsSimpleModeKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AppExitedNormaly
|
public int StartCount
|
||||||
{
|
{
|
||||||
get
|
get { return GetInt(StartCountKey); }
|
||||||
{
|
set { SetInt(StartCountKey, value); }
|
||||||
return GetValue(AppExitedNormalyKey, true);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
set
|
public int StartCountDurringExit
|
||||||
{
|
{
|
||||||
SetValue(AppExitedNormalyKey, value);
|
get { return GetInt(StartCountDurringExitKey); }
|
||||||
}
|
set { SetInt(StartCountDurringExitKey, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EmbededViewShowingGCode
|
public bool EmbededViewShowingGCode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return GetValue(EmbededViewShowingGCodeKey, false);
|
return GetBool(EmbededViewShowingGCodeKey, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetValue(EmbededViewShowingGCodeKey, value);
|
SetBool(EmbededViewShowingGCodeKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValue(string keyToSet, bool value)
|
public void SetBool(string keyToSet, bool value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
|
|
@ -95,7 +96,7 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetValue(string keyToRead, bool defaultValue)
|
public bool GetBool(string keyToRead, bool defaultValue)
|
||||||
{
|
{
|
||||||
string currentValue = UserSettings.Instance.get(keyToRead);
|
string currentValue = UserSettings.Instance.get(keyToRead);
|
||||||
if (acceptableTrueFalseValues.IndexOf(currentValue) == -1)
|
if (acceptableTrueFalseValues.IndexOf(currentValue) == -1)
|
||||||
|
|
@ -112,5 +113,22 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
return currentValue == "true";
|
return currentValue == "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetInt(string keyToSet, int value)
|
||||||
|
{
|
||||||
|
UserSettings.Instance.set(keyToSet, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetInt(string keyToRead)
|
||||||
|
{
|
||||||
|
string currentValue = UserSettings.Instance.get(keyToRead);
|
||||||
|
int result = 0;
|
||||||
|
if(int.TryParse(currentValue, out result))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue