Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: luke-barnett/B3
base: 34bbac1658
...
head fork: luke-barnett/B3
compare: 3b5a4f5b5b
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 10 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 26, 2012
Luke Barnett Added in auto save interval 06d9a4d
Luke Barnett Turn off view all sensors when exiting graph 651b78b
Luke Barnett Corrected Exporter from hhmm to hh:mm in all places
Added the ability to import/export/delete sites
31753e4
Luke Barnett Removes all besides the latest 5 exported files when exporting for ba…
…ckup purposes
b39a184
Luke Barnett Added cancel button to reason request to cancel action
If a preview is made when removing values, it is reset
3b5a4f5
View
16 IndiaTango/IndiaTango/Models/Common.cs
@@ -53,10 +53,20 @@ public static string DatasetSaveLocation
}
}
+ public static string DatasetExportRootFolder(Dataset dataset)
+ {
+ var directory = Path.Combine(AppDataPath, "Backups", "Exports", dataset.Site.Name);
+
+ if (!Directory.Exists(directory))
+ Directory.CreateDirectory(directory);
+
+ return directory;
+ }
+
public static string DatasetExportLocation(Dataset dataset)
{
var timestamp = DateTime.Now;
- var directory = Path.Combine(AppDataPath, "Backups", "Exports", dataset.Site.Name, timestamp.ToString("yyyy"), timestamp.ToString("MMMM"), timestamp.ToString("dd"));
+ var directory = Path.Combine(AppDataPath, "Backups", "Exports", dataset.Site.Name, timestamp.ToString("yyyy"), timestamp.ToString("MM"), timestamp.ToString("dd"));
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
@@ -203,6 +213,7 @@ public static ChangeReason RequestReason(SimpleContainer container, IWindowManag
specify.Message = "Please specify a reason for this change:";
specify.ShowComboBox = true;
specify.ComboBoxItems = ChangeReason.ChangeReasons.Where(x => !x.Reason.StartsWith("[Importer]")).Select(x => x.Reason).ToList();
+ specify.ShowCancel = true;
var defaultReason = ChangeReason.ChangeReasons.FirstOrDefault(x => x.ID == defaultReasonNumber);
@@ -211,6 +222,9 @@ public static ChangeReason RequestReason(SimpleContainer container, IWindowManag
windowManager.ShowDialog(specify);
+ if (specify.WasCanceled)
+ return null;
+
return ChangeReason.ChangeReasons.FirstOrDefault(x => x.Reason == specify.Text) ?? ChangeReason.AddNewChangeReason(specify.Text);
}
View
35 IndiaTango/IndiaTango/Models/Dataset.cs
@@ -388,7 +388,7 @@ private static Dataset LoadDataSetFromFile(string filename)
var siteStream = new MemoryStream();
zip.Entries.First(x => x.FileName == "site").Extract(siteStream);
siteStream.Position = 0;
-
+
dataset.Site = Serializer.Deserialize<Site>(siteStream);
if (zip.EntryFileNames.Contains("siteimages"))
@@ -464,24 +464,43 @@ private static Dataset LoadDataSetFromFile(string filename)
}
}
+ public void SaveToFile(bool exportData = true, bool deleteFile = false)
+ {
+ SaveToFile(SaveLocation, exportData, deleteFile);
+ }
+
/// <summary>
/// Saves the dataset to disk
/// </summary>
+ /// <param name="saveLocation">Location to save file to</param>
/// <param name="exportData">Whether or not to export the data</param>
/// <param name="deleteFile">Whether or not to first delete the file</param>
- public void SaveToFile(bool exportData = true, bool deleteFile = false)
+ public void SaveToFile(string saveLocation, bool exportData, bool deleteFile)
{
- if (deleteFile && File.Exists(SaveLocation))
- File.Delete(SaveLocation);
+ if (deleteFile && File.Exists(saveLocation))
+ File.Delete(saveLocation);
if (!Directory.Exists(Common.DatasetSaveLocation))
Directory.CreateDirectory(Common.DatasetSaveLocation);
- if (File.Exists(SaveLocation))
- File.Copy(SaveLocation, SaveLocation + ".backup", true);
+ if (File.Exists(saveLocation))
+ File.Copy(saveLocation, saveLocation + ".backup", true);
if (exportData)
+ {
+ var exportFolder = Common.DatasetExportRootFolder(this);
+ var exportedFiles = Directory.GetFiles(exportFolder, "*.*", SearchOption.AllDirectories).OrderBy(x => x).ToArray();
+
+ if(exportedFiles.Length >= 5)
+ {
+ for (var i = 0; i < exportedFiles.Length - 4; i++)
+ {
+ File.Delete(exportedFiles[i]);
+ }
+ }
+
DatasetExporter.Export(this, Common.DatasetExportLocation(this), ExportFormat.CSV, true);
+ }
/* .NET BinaryFormatter
using (var stream = new FileStream(SaveLocation, FileMode.Create))
@@ -492,7 +511,7 @@ public void SaveToFile(bool exportData = true, bool deleteFile = false)
Serializer.Serialize(file, this);
*/
- using (var zip = File.Exists(SaveLocation) ? ZipFile.Read(SaveLocation) : new ZipFile())
+ using (var zip = File.Exists(saveLocation) ? ZipFile.Read(saveLocation) : new ZipFile())
{
zip.CompressionLevel = CompressionLevel.None;
zip.Comment = string.Format("B3 ZIP FORMAT v1.1");
@@ -547,7 +566,7 @@ public void SaveToFile(bool exportData = true, bool deleteFile = false)
}
}
- zip.Save(SaveLocation);
+ zip.Save(saveLocation);
}
}
View
4 IndiaTango/IndiaTango/Models/DatasetExporter.cs
@@ -211,7 +211,7 @@ private static void ExportCSV(Dataset data, string filePath, bool includeEmptyLi
const char del = ',';
var columnHeadings = dateColumnFormat.Equals(DateColumnFormat.SplitDateColumn)
? "DD" + del + "MM" + del + "YYYY" + del + "hh" + del + "mm"
- : "DD/MM/YYYY" + del + "hhmm";
+ : "DD/MM/YYYY" + del + "hh:mm";
var currentSensorIndex = 0;
var outputData = new string[data.Sensors.Count, (data.ExpectedDataPointCount / numOfPointsToSummarise) + 1];
var rowDate = data.StartTimeStamp;
@@ -484,7 +484,7 @@ private DateColumnFormat(string name, string description)
public string Name { get { return _name; } }
- public static DateColumnFormat TwoDateColumn { get { return new DateColumnFormat("Two Column", "Two date and time columns (DD/MM/YYYY | hhmm)"); } }
+ public static DateColumnFormat TwoDateColumn { get { return new DateColumnFormat("Two Column", "Two date and time columns (DD/MM/YYYY | hh:mm)"); } }
public static DateColumnFormat SplitDateColumn { get { return new DateColumnFormat("Split Column", "Split date and time columns (DD | MM | YYYY | hh | mm)"); } }
View
24 IndiaTango/IndiaTango/Properties/Settings.Designer.cs
@@ -70,5 +70,29 @@ internal sealed partial class Settings : global::System.Configuration.Applicatio
this["UndoStatesToRemember"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("300000")]
+ public int AutoSaveTimerInterval {
+ get {
+ return ((int)(this["AutoSaveTimerInterval"]));
+ }
+ set {
+ this["AutoSaveTimerInterval"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool AutoSaveTimerEnabled {
+ get {
+ return ((bool)(this["AutoSaveTimerEnabled"]));
+ }
+ set {
+ this["AutoSaveTimerEnabled"] = value;
+ }
+ }
}
}
View
6 IndiaTango/IndiaTango/Properties/Settings.settings
@@ -14,5 +14,11 @@
<Setting Name="UndoStatesToRemember" Type="System.Int32" Scope="User">
<Value Profile="(Default)">5</Value>
</Setting>
+ <Setting Name="AutoSaveTimerInterval" Type="System.Int32" Scope="User">
+ <Value Profile="(Default)">300000</Value>
+ </Setting>
+ <Setting Name="AutoSaveTimerEnabled" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">True</Value>
+ </Setting>
</Settings>
</SettingsFile>
View
194 IndiaTango/IndiaTango/ViewModels/MainWindowViewModel.cs
@@ -6,6 +6,7 @@
using System.Data;
using System.Diagnostics;
using System.Globalization;
+using System.IO;
using System.Linq;
using System.Threading;
using System.Windows;
@@ -156,6 +157,37 @@ public MainWindowViewModel(IWindowManager windowManager, SimpleContainer contain
};
BuildDetectionMethodTabItems();
+
+ var autoSaveTimer = new System.Timers.Timer();
+ autoSaveTimer.Elapsed += (o, e) =>
+ {
+ if (CurrentDataset != null)
+ {
+ Save();
+ }
+ };
+ autoSaveTimer.AutoReset = true;
+ autoSaveTimer.Interval = Properties.Settings.Default.AutoSaveTimerInterval;
+ if (Properties.Settings.Default.AutoSaveTimerEnabled)
+ autoSaveTimer.Start();
+
+ Properties.Settings.Default.PropertyChanged += (o, e) =>
+ {
+ switch (e.PropertyName)
+ {
+ case "AutoSaveTimerInterval":
+ autoSaveTimer.Interval =
+ Properties.Settings.Default.
+ AutoSaveTimerInterval;
+ break;
+ case "AutoSaveTimerEnabled":
+ if (Properties.Settings.Default.AutoSaveTimerEnabled)
+ autoSaveTimer.Start();
+ else
+ autoSaveTimer.Stop();
+ break;
+ }
+ };
}
#region Private Parameters
@@ -996,6 +1028,17 @@ public string HighestYearLoaded
#region Private Methods
/// <summary>
+ /// Clears all detected values
+ /// </summary>
+ private void ClearDetectedValues()
+ {
+ foreach (var method in _detectionMethods)
+ {
+ method.ListBox.Items.Clear();
+ }
+ }
+
+ /// <summary>
/// Update the GUI for new dataset values
/// </summary>
private void UpdateGUI()
@@ -1641,6 +1684,9 @@ private TabItem GenerateCalibrationTabItem()
var reason = Common.RequestReason(_container, _windowManager, 12);
+ if (reason == null)
+ return;
+
ApplicationCursor = Cursors.Wait;
var result = useSelected ? _evaluator.EvaluateFormula(formula, Selection.LowerX.Round(TimeSpan.FromMinutes(CurrentDataset.DataInterval)), Selection.UpperX, skipMissingValues, reason) : _evaluator.EvaluateFormula(formula, StartTime.Round(TimeSpan.FromMinutes(CurrentDataset.DataInterval)), EndTime, skipMissingValues, reason);
@@ -2132,6 +2178,8 @@ private TabItem GenerateCalibrationTabItem()
// useSelected = Common.Confirm("Should we use your selection?",
// "Should we use the date range of your selection for to apply the formula on?");
var reason = Common.RequestReason(_container, _windowManager, 4);
+ if (reason == null)
+ return;
var successfulSensors = new List<Sensor>();
foreach (var sensor in SensorsToCheckMethodsAgainst.Where(x => (string)applyToCombo.SelectedItem == "All graphed sensors" || (string)applyToCombo.SelectedItem == x.Name))
{
@@ -2494,6 +2542,9 @@ private void Interpolate(IEnumerable<ErroneousValue> values, IDetectionMethod me
var reason = Common.RequestReason(_container, _windowManager, (!usingSelection && methodCheckedAgainst != null) ? methodCheckedAgainst.DefaultReasonNumber : 7);
+ if (reason == null)
+ return;
+
bw.DoWork += (o, e) =>
{
foreach (var sensor in sensorList)
@@ -2516,6 +2567,12 @@ private void Interpolate(IEnumerable<ErroneousValue> values, IDetectionMethod me
CheckTheseMethods(new Collection<IDetectionMethod> { methodCheckedAgainst });
};
+ if (_manualPreviewTextBlock.Text == "Reject")
+ _manualPreviewTextBlock.Text = "Preview";
+
+ if (_automaticPreviewTextBlock.Text == "Reject")
+ _automaticPreviewTextBlock.Text = "Preview";
+
FeaturesEnabled = false;
ShowProgressArea = true;
ProgressIndeterminate = true;
@@ -2577,6 +2634,10 @@ private void RemoveValues(IEnumerable<ErroneousValue> values, IDetectionMethod m
var bw = new BackgroundWorker();
var reason = Common.RequestReason(_container, _windowManager, (!usingSelection && methodCheckedAgainst != null) ? methodCheckedAgainst.DefaultReasonNumber : 7);
+
+ if (reason == null)
+ return;
+
bw.DoWork += (o, e) =>
{
foreach (var sensor in sensorList)
@@ -2599,6 +2660,12 @@ private void RemoveValues(IEnumerable<ErroneousValue> values, IDetectionMethod m
CheckTheseMethods(new Collection<IDetectionMethod> { methodCheckedAgainst });
};
+ if (_manualPreviewTextBlock.Text == "Reject")
+ _manualPreviewTextBlock.Text = "Preview";
+
+ if (_automaticPreviewTextBlock.Text == "Reject")
+ _automaticPreviewTextBlock.Text = "Preview";
+
FeaturesEnabled = false;
ShowProgressArea = true;
ProgressIndeterminate = true;
@@ -2673,6 +2740,9 @@ private void SpecifyValue(IEnumerable<ErroneousValue> values, IDetectionMethod m
var reason = Common.RequestReason(_container, _windowManager, (!usingSelection && methodCheckedAgainst != null) ? methodCheckedAgainst.DefaultReasonNumber : 7);
+ if (reason == null)
+ return;
+
var bw = new BackgroundWorker();
bw.DoWork += (o, e) =>
@@ -2697,6 +2767,12 @@ private void SpecifyValue(IEnumerable<ErroneousValue> values, IDetectionMethod m
CheckTheseMethods(new Collection<IDetectionMethod> { methodCheckedAgainst });
};
+ if (_manualPreviewTextBlock.Text == "Reject")
+ _manualPreviewTextBlock.Text = "Preview";
+
+ if (_automaticPreviewTextBlock.Text == "Reject")
+ _automaticPreviewTextBlock.Text = "Preview";
+
FeaturesEnabled = false;
ShowProgressArea = true;
ProgressIndeterminate = true;
@@ -2982,6 +3058,47 @@ public void Import()
}
/// <summary>
+ /// Copies a site to the appdata
+ /// </summary>
+ public void ImportSite()
+ {
+ var openFileDialog = new OpenFileDialog { Filter = "B3 Files | *.b3" };
+
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ var file = openFileDialog.FileName.Substring(openFileDialog.FileName.LastIndexOf('\\') + 1);
+
+ var copyLocation = Path.Combine(Common.DatasetSaveLocation, file);
+
+ if ((File.Exists(copyLocation)))
+ {
+ if (Common.Confirm("Overwrite existing dataset?", "We already have a dataset under that name, if we continue it will be overwritten"))
+ {
+ File.Delete(copyLocation);
+ File.Copy(openFileDialog.FileName, copyLocation);
+ }
+
+ }
+ else
+ File.Copy(openFileDialog.FileName, copyLocation);
+
+ if (CurrentDataset.SaveLocation == copyLocation)
+ UpdateSelectedSite(false, true);
+ }
+
+ _dataSetFiles = null;
+ NotifyOfPropertyChange(() => SiteNames);
+
+ _sensorsToGraph.Clear();
+ SensorsToCheckMethodsAgainst.Clear();
+ NotifyOfPropertyChange(() => LowestYearLoadedOptions);
+ NotifyOfPropertyChange(() => HighestYearLoadedOptions);
+ NotifyOfPropertyChange(() => HighestYearLoaded);
+ NotifyOfPropertyChange(() => LowestYearLoaded);
+ ClearDetectedValues();
+ }
+
+ /// <summary>
/// Starts a new export of data
/// </summary>
public void Export()
@@ -3029,6 +3146,66 @@ public void Save()
}
/// <summary>
+ /// Saves to file
+ /// </summary>
+ public void DeleteSite()
+ {
+ if (CurrentDataset == null)
+ return;
+
+ if (Common.Confirm("Are you sure?", "Deleting the site is permantent and cannot be undone"))
+ {
+ if (File.Exists(CurrentDataset.SaveLocation))
+ File.Delete(CurrentDataset.SaveLocation);
+ if (File.Exists(CurrentDataset.SaveLocation + ".backup"))
+ File.Delete(CurrentDataset.SaveLocation + ".backup");
+ CurrentDataset = null;
+ _dataSetFiles = null;
+ ChosenSelectedIndex = -1;
+ _sensorsToGraph.Clear();
+ SensorsToCheckMethodsAgainst.Clear();
+ NotifyOfPropertyChange(() => SiteNames);
+ NotifyOfPropertyChange(() => LowestYearLoadedOptions);
+ NotifyOfPropertyChange(() => HighestYearLoadedOptions);
+ NotifyOfPropertyChange(() => HighestYearLoaded);
+ NotifyOfPropertyChange(() => LowestYearLoaded);
+ }
+ }
+
+ /// <summary>
+ /// Saves to specified file
+ /// </summary>
+ public void SaveAs()
+ {
+ if (CurrentDataset == null)
+ return;
+
+ var saveFileDialog = new FolderBrowserDialog();
+ if (saveFileDialog.ShowDialog() != DialogResult.OK)
+ return;
+
+ var bw = new BackgroundWorker();
+
+ bw.DoWork += (o, e) =>
+ {
+ var fileName = Path.Combine(saveFileDialog.SelectedPath, string.Format("{0} - {1}.b3", CurrentDataset.Site.Id, CurrentDataset.Site.Name));
+ WaitEventString = string.Format("Saving {0} to file {1}", CurrentDataset.Site.Name, fileName);
+ if (File.Exists(CurrentDataset.SaveLocation))
+ File.Copy(CurrentDataset.SaveLocation, fileName);
+ CurrentDataset.SaveToFile(fileName, false, false);
+ };
+ bw.RunWorkerCompleted += (o, e) =>
+ {
+ ShowProgressArea = false;
+ EnableFeatures();
+ };
+ ProgressIndeterminate = true;
+ ShowProgressArea = true;
+ DisableFeatures();
+ bw.RunWorkerAsync();
+ }
+
+ /// <summary>
/// Creates a new site
/// </summary>
public void CreateNewSite()
@@ -3068,6 +3245,7 @@ public void CreateNewSite()
if (ShowSiteInformation(newDataset))
{
CurrentDataset = newDataset;
+ ClearDetectedValues();
}
else
{
@@ -3094,6 +3272,14 @@ public void Exit()
/// </summary>
public void UpdateSelectedSite()
{
+ UpdateSelectedSite(true, false);
+ }
+
+ /// <summary>
+ /// Update the selected site to the one corresponding to the selected index
+ /// </summary>
+ public void UpdateSelectedSite(bool askToSaveFirst, bool forceUpdate)
+ {
if (_chosenSelectedIndex == 0)
{
CreateNewSite();
@@ -3103,7 +3289,7 @@ public void UpdateSelectedSite()
if (!DataSetFiles.Any())
CurrentDataset = null;
- if (CurrentDataset != null && DataSetFiles[_chosenSelectedIndex - 1] == CurrentDataset.SaveLocation)
+ if (!forceUpdate && CurrentDataset != null && DataSetFiles[_chosenSelectedIndex - 1] == CurrentDataset.SaveLocation)
return;
_sensorsToGraph.Clear();
@@ -3118,7 +3304,7 @@ public void UpdateSelectedSite()
var saveFirst = false;
- if (CurrentDataset != null)
+ if (CurrentDataset != null && askToSaveFirst)
{
saveFirst = Common.Confirm("Save before closing?",
string.Format("Before we close '{0}' should we save it first?",
@@ -3169,6 +3355,7 @@ public void UpdateSelectedSite()
, false, false);
};
+ ClearDetectedValues();
DisableFeatures();
bw.RunWorkerAsync();
}
@@ -3638,7 +3825,7 @@ public void ClosingRequested(CancelEventArgs eventArgs)
/// <param name="updateGraph">Whether or not to update the graph or not</param>
public void AddToGraph(GraphableSensor graphableSensor, bool updateGraph = true)
{
- if(graphableSensor.BoundsSet)
+ if (graphableSensor.BoundsSet)
graphableSensor.RemoveBounds();
if (_sensorsToGraph.FirstOrDefault(x => x.BoundsSet) != null)
graphableSensor.SetUpperAndLowerBounds(StartTime, EndTime);
@@ -3996,6 +4183,7 @@ public void AddNewMetaData(GraphableSensor sensor, KeyEventArgs keyPressEvent, C
public void EnableGraph()
{
_graphEnabled = true;
+ ViewAllSensors = false;
SampleValues(Common.MaximumGraphablePoints, _sensorsToGraph, "EnablingGraph");
}
View
66 IndiaTango/IndiaTango/ViewModels/SettingsViewModel.cs
@@ -1,30 +1,24 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Caliburn.Micro;
-using IndiaTango.Models;
+using IndiaTango.Models;
namespace IndiaTango.ViewModels
{
class SettingsViewModel : BaseViewModel
{
- private IWindowManager _windowManager;
- private SimpleContainer _container;
- private bool _dontNotifyIfFailing = false;
- private bool _formulaValidationAsTyped = false;
- private int _errorThreshold = 0;
+ private bool _dontNotifyIfFailing;
+ private bool _formulaValidationAsTyped;
+ private int _errorThreshold;
+ private int _autoSaveInterval;
+ private bool _autoSaveEnabled;
- public SettingsViewModel(SimpleContainer container, IWindowManager windowManager)
+ public SettingsViewModel()
{
- _windowManager = windowManager;
- _container = container;
-
// Load in settings
- DontNotifyIfFailing = IndiaTango.Properties.Settings.Default.IgnoreSensorErrorDetection;
- FormulaValidationAsTyped = IndiaTango.Properties.Settings.Default.EvaluateFormulaOnKeyUp;
- ErrorThreshold = IndiaTango.Properties.Settings.Default.DefaultErrorThreshold;
+ DontNotifyIfFailing = Properties.Settings.Default.IgnoreSensorErrorDetection;
+ FormulaValidationAsTyped = Properties.Settings.Default.EvaluateFormulaOnKeyUp;
+ ErrorThreshold = Properties.Settings.Default.DefaultErrorThreshold;
+ AutoSaveInterval = Properties.Settings.Default.AutoSaveTimerInterval / 60000;
+ AutoSaveEnabled = Properties.Settings.Default.AutoSaveTimerEnabled;
}
/// <summary>
@@ -71,28 +65,48 @@ public int ErrorThreshold
}
/// <summary>
+ /// The interval for auto save
+ /// </summary>
+ public int AutoSaveInterval
+ {
+ get { return _autoSaveInterval; }
+ set { _autoSaveInterval = value; NotifyOfPropertyChange(() => AutoSaveInterval); }
+ }
+
+ /// <summary>
+ /// If auto save is enabled or not
+ /// </summary>
+ public bool AutoSaveEnabled
+ {
+ get { return _autoSaveEnabled; }
+ set { _autoSaveEnabled = value; NotifyOfPropertyChange(() => AutoSaveEnabled); }
+ }
+
+ /// <summary>
/// Saves the settings and closes the window
/// </summary>
- public void btnSave()
+ public void BtnSave()
{
- IndiaTango.Properties.Settings.Default.DefaultErrorThreshold = ErrorThreshold;
- IndiaTango.Properties.Settings.Default.EvaluateFormulaOnKeyUp = FormulaValidationAsTyped;
- IndiaTango.Properties.Settings.Default.IgnoreSensorErrorDetection = DontNotifyIfFailing;
+ Properties.Settings.Default.DefaultErrorThreshold = ErrorThreshold;
+ Properties.Settings.Default.EvaluateFormulaOnKeyUp = FormulaValidationAsTyped;
+ Properties.Settings.Default.IgnoreSensorErrorDetection = DontNotifyIfFailing;
+ Properties.Settings.Default.AutoSaveTimerInterval = AutoSaveInterval * 60000;
+ Properties.Settings.Default.AutoSaveTimerEnabled = AutoSaveEnabled;
- IndiaTango.Properties.Settings.Default.Save();
+ Properties.Settings.Default.Save();
Common.ShowMessageBox("Your settings have been saved",
"The changes you've made to these settings have been saved, and will take effect immediately.",
false, false);
- this.TryClose();
+ TryClose();
}
/// <summary>
/// Closes the window
/// </summary>
- public void btnDone()
+ public void BtnDone()
{
- this.TryClose();
+ TryClose();
}
}
}
View
13 IndiaTango/IndiaTango/Views/MainWindowView.xaml
@@ -38,10 +38,17 @@
<Menu Grid.Row="0" x:Name="MainMenu" IsMainMenu="True" IsEnabled="{Binding FeaturesEnabled}">
<MenuItem Header="_File">
+ <MenuItem Header="_New Site" cal:Message.Attach="[Event Click] = [Action CreateNewSite]" />
+ <Separator />
<MenuItem Header="_Save" cal:Message.Attach="[Event Click] = [Action Save]" />
+ <MenuItem Header="Save _As..." cal:Message.Attach="[Event Click] = [Action SaveAs]" />
+ <Separator />
<MenuItem Header="_Import" cal:Message.Attach="[Event Click] = [Action Import]" />
- <MenuItem Header="E_xport" cal:Message.Attach="[Event Click] = [Action Export]" />
- <MenuItem Header="_New Site" cal:Message.Attach="[Event Click] = [Action CreateNewSite]" />
+ <MenuItem Header="I_mport Site..." cal:Message.Attach="[Event Click] = [Action ImportSite]" />
+ <MenuItem Header="E_xport..." cal:Message.Attach="[Event Click] = [Action Export]" />
+ <Separator />
+ <MenuItem Header="_Delete Site" cal:Message.Attach="[Event Click] = [Action DeleteSite]" />
+ <Separator />
<MenuItem Header="Se_ttings" cal:Message.Attach="[Event Click] = [Action ShowSettings]" />
<MenuItem Header="_Exit" cal:Message.Attach="[Event Click] = [Action Exit]" />
</MenuItem>
@@ -420,7 +427,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Text="Current Site:" Margin="10,0" VerticalAlignment="Center" />
- <ComboBox IsEnabled="{Binding FeaturesEnabled}" ItemsSource="{Binding SiteNames}" Width="120" SelectedIndex="{Binding ChosenSelectedIndex, Mode=TwoWay}" cal:Message.Attach="[Event SelectionChanged] = [Action UpdateSelectedSite]" />
+ <ComboBox IsEnabled="{Binding FeaturesEnabled}" ItemsSource="{Binding SiteNames}" Width="120" SelectedIndex="{Binding ChosenSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" cal:Message.Attach="[Event SelectionChanged] = [Action UpdateSelectedSite]" />
<Button IsEnabled="{Binding FeaturesEnabled}" Margin="10,0" Content="Site Information" cal:Message.Attach="[Event Click] = [Action ShowCurrentSiteInformation]" />
</StackPanel>
</Grid>
View
11 IndiaTango/IndiaTango/Views/SettingsView.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
- Title="{Binding WindowTitle}" Icon="{Binding Icon}" Height="180" Width="502" WindowStartupLocation="CenterOwner">
+ Title="{Binding WindowTitle}" Icon="{Binding Icon}" Height="210" Width="502" WindowStartupLocation="CenterOwner">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
@@ -25,6 +25,11 @@
<wpf:IntegerUpDown Margin="5" Width="50" Value="{Binding ErrorThreshold}" IsEnabled="{Binding DontNotifyIfFailing}" VerticalAlignment="Top" />
<TextBlock Margin="5 5 5 5" Text="missing values, tell me it's failing" IsEnabled="{Binding DontNotifyIfFailing}"/>
</StackPanel>-->
+ <StackPanel Grid.Row="3" Margin="10 0" Orientation="Horizontal">
+ <CheckBox Margin="0 5" Content="Auto save" VerticalAlignment="Center" IsChecked="{Binding AutoSaveEnabled}" />
+ <wpf:IntegerUpDown Margin="5" Width="50" Value="{Binding AutoSaveInterval}" IsEnabled="{Binding AutoSaveEnabled}" VerticalAlignment="Top" />
+ <TextBlock Margin="5" VerticalAlignment="Center" Text="Auto save interval (mins)" IsEnabled="{Binding AutoSaveEnabled}"/>
+ </StackPanel>
<Grid Grid.Row="6">
<Grid.ColumnDefinitions>
@@ -33,14 +38,14 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <Button Name="btnSave" Grid.Column="1" Margin="5">
+ <Button Name="BtnSave" Grid.Column="1" Margin="5">
<StackPanel Orientation="Horizontal">
<Image Source="/B3;component/Images/save_32.png" Width="32" Height="32" />
<TextBlock FontSize="15" Margin="5" Text="Save" />
</StackPanel>
</Button>
- <Button Name="btnDone" Grid.Column="2" Margin="5">
+ <Button Name="BtnDone" Grid.Column="2" Margin="5">
<StackPanel Orientation="Horizontal">
<Image Source="/B3;component/Images/done_32.png" Width="32" Height="32" />
<TextBlock FontSize="15" Margin="5" Text="Done" />
View
6 IndiaTango/IndiaTango/app.config
@@ -19,6 +19,12 @@
<setting name="UndoStatesToRemember" serializeAs="String">
<value>5</value>
</setting>
+ <setting name="AutoSaveTimerInterval" serializeAs="String">
+ <value>300000</value>
+ </setting>
+ <setting name="AutoSaveTimerEnabled" serializeAs="String">
+ <value>True</value>
+ </setting>
</IndiaTango.Properties.Settings>
</userSettings>
</configuration>

No commit comments for this range

Something went wrong with that request. Please try again.