diff --git a/VisualTeensy/App.xaml.cs b/VisualTeensy/App.xaml.cs index bb3470a..025efd9 100644 --- a/VisualTeensy/App.xaml.cs +++ b/VisualTeensy/App.xaml.cs @@ -92,14 +92,14 @@ SetupData loadSetup() setupData.mru.load(Settings.Default.mruString); Helpers.arduinoPath = setupData.arduinoBase; - using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_make"))) - { - setupData.makefile_fixed = reader.ReadToEnd(); - } - using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_builder"))) - { - setupData.makefile_builder = reader.ReadToEnd(); - } + //using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_make"))) + //{ + // setupData.makefile_fixed = reader.ReadToEnd(); + //} + //using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_builder"))) + //{ + // setupData.makefile_builder = reader.ReadToEnd(); + //} @@ -135,10 +135,11 @@ void saveSetup(SetupData setupData) protected override void OnStartup(StartupEventArgs e) - { + { + CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US"); + this.ShutdownMode = ShutdownMode.OnExplicitShutdown; - CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US"); // create applicaton folder \AppData\Local\VisualTeensy (if not yet existing) Directory.CreateDirectory(SetupData.vtAppFolder); diff --git a/VisualTeensy/Properties/AssemblyInfo.cs b/VisualTeensy/Properties/AssemblyInfo.cs index 657a60e..7505828 100644 --- a/VisualTeensy/Properties/AssemblyInfo.cs +++ b/VisualTeensy/Properties/AssemblyInfo.cs @@ -50,7 +50,7 @@ // 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.1.0")] -[assembly: AssemblyFileVersion("1.1.0")] +[assembly: AssemblyVersion("1.2.0")] +[assembly: AssemblyFileVersion("1.2.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/VisualTeensy/ViewModel/MainWin/MainVM.cs b/VisualTeensy/ViewModel/MainWin/MainVM.cs index e239449..e02003e 100644 --- a/VisualTeensy/ViewModel/MainWin/MainVM.cs +++ b/VisualTeensy/ViewModel/MainWin/MainVM.cs @@ -1,5 +1,7 @@ -using System.Collections.ObjectModel; +using log4net; +using System.Collections.ObjectModel; using System.IO; +using System.Reflection; using System.Windows; using vtCore; using vtCore.Interfaces; @@ -110,17 +112,19 @@ public MainVM(IProject project, LibManager libManager, SetupData setup) projecTabVM.OnPropertyChanged(""); }; - mruList = new ObservableCollection(); + mruList = new ObservableCollection(); foreach (var prj in setup.mru.projects) { mruList.Add(new MruItemVM(prj, this)); } - //var mruList = setup.mru.projects?.Select(p => new MruItemVM(p, this)); - //if(mruList != null) mruList = new ObservableCollection(mruList); + log.Info($"MRU list loaded ({mruList.Count} entries)"); + log.Info("constructed"); } public LibManager libManager { get; } public SetupData setup { get; } public IProject project { get; } + + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } } diff --git a/VisualTeensy/ViewModel/ProjectTab/ProjectTabVM.cs b/VisualTeensy/ViewModel/ProjectTab/ProjectTabVM.cs index 6089dd6..7378021 100644 --- a/VisualTeensy/ViewModel/ProjectTab/ProjectTabVM.cs +++ b/VisualTeensy/ViewModel/ProjectTab/ProjectTabVM.cs @@ -4,7 +4,8 @@ using System.Linq; using vtCore.Interfaces; using vtCore; - +using log4net; +using System.Reflection; namespace ViewModel { @@ -76,14 +77,6 @@ void doClose(object o) { // model.saveSettings(); } - - public RelayCommand cmdCoreSelected { get; private set; } - void doCoreSelected(object o) - { - project.coreStrategy = (CoreStrategies)o; - } - - #endregion #region Properties ---------------------------------------------------- @@ -102,28 +95,16 @@ public BoardVM selectedBoard } } - public bool isMakefileBuild => project.buildSystem == BuildSystem.makefile; - // set - // { - // if (value != project.isMakefileBuild) - // { - // project.isMakefileBuild = value; - // OnPropertyChanged(); - // } - // } - //} - - - public bool quickSetup + + public SetupTypes setupType { - get => project.selectedConfiguration.setupType == SetupTypes.quick ? true : false; + get => project.selectedConfiguration.setupType; set { - SetupTypes newType = value == true ? SetupTypes.quick : SetupTypes.expert; // hack, valueConverter would be better - if (project.selectedConfiguration.setupType != newType) + if (project.selectedConfiguration.setupType != value) { - project.selectedConfiguration.setupType = newType; + project.selectedConfiguration.setupType = value; updateAll(); OnPropertyChanged(""); } @@ -140,7 +121,21 @@ public bool hasDebugSupport OnPropertyChanged(""); } } - + + public LibStrategy coreStragegy + { + get => project.selectedConfiguration.coreStrategy; + set + { + if (value != project.selectedConfiguration.coreStrategy) + { + project.selectedConfiguration.coreStrategy = value; + updateFiles(); + OnPropertyChanged(""); + } + } + } + public string makefileExtension { get => project.selectedConfiguration.makefileExtension; @@ -210,46 +205,7 @@ public String arduinoBase } } } - //public String boardTxtPath - //{ - // get => project.selectedConfiguration.boardTxtPath; - // set - // { - // if (value != project.selectedConfiguration.boardTxtPath) - // { - // project.selectedConfiguration.boardTxtPath = value.Trim(); - // updateAll(); - // OnPropertyChanged(""); - // } - // } - //} - //public bool copyBoardTxt - //{ - // get => project.selectedConfiguration.copyBoardTxt; - // set - // { - // if (value != project.selectedConfiguration.copyBoardTxt) - // { - // project.selectedConfiguration.copyBoardTxt = value; - // OnPropertyChanged(); - // updateFiles(); - // } - // } - //} - - public bool copyCore - { - get => project.selectedConfiguration.copyCore; - set - { - if (value != project.selectedConfiguration.copyCore) - { - project.selectedConfiguration.copyCore = value; - OnPropertyChanged(); - updateFiles(); - } - } - } + public String corePath { get => project.selectedConfiguration.coreBase.path; @@ -303,13 +259,13 @@ public ProjectTabVM(IProject project, LibManager libManager, SetupData setup) settFile = ProjectSettings.generate(project); debugFile = DebugFile.generate(project, setup); - - cmdGenerate = new RelayCommand(doGenerate);//, o => project.pathError == null && !String.IsNullOrWhiteSpace(project.selectedConfiguration.makefile) && !String.IsNullOrWhiteSpace(project.tasks_json) && !String.IsNullOrWhiteSpace(project.props_json)); cmdClose = new RelayCommand(doClose); - cmdCoreSelected = new RelayCommand(doCoreSelected); - + updateBoards(); + OnPropertyChanged(""); + + log.Info("constructed"); } internal void updateAll() @@ -320,7 +276,7 @@ internal void updateAll() } internal void updateFiles() { - + makefile = Makefile.generate(project, libManager, setup); taskFile = TaskFile.generate(project, setup); @@ -365,6 +321,9 @@ protected void Message(string message) public IProject project; LibManager libManager; SetupData setup; + + + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } } diff --git a/VisualTeensy/ViewModel/SaveWin/SaveWinVM.cs b/VisualTeensy/ViewModel/SaveWin/SaveWinVM.cs index 0523e38..230a28e 100644 --- a/VisualTeensy/ViewModel/SaveWin/SaveWinVM.cs +++ b/VisualTeensy/ViewModel/SaveWin/SaveWinVM.cs @@ -23,10 +23,10 @@ async Task doSave() while (!taskVMs.IsCurrentAfterLast) { var taskVM = (TaskVM)taskVMs.CurrentItem; - log.Info(taskVM.title); + log.Info(taskVM.title + " started..."); await taskVM.action(); - await Task.Delay(50); + await Task.Delay(150); log.Info($"{taskVM.title} done"); taskVMs.MoveCurrentToNext(); diff --git a/VisualTeensy/ViewModel/SetupTab/SetupTabVM.cs b/VisualTeensy/ViewModel/SetupTab/SetupTabVM.cs index eda7e91..aba0a23 100644 --- a/VisualTeensy/ViewModel/SetupTab/SetupTabVM.cs +++ b/VisualTeensy/ViewModel/SetupTab/SetupTabVM.cs @@ -1,7 +1,9 @@ -using System; +using log4net; +using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Drawing; +using System.Reflection; using System.Windows.Data; using vtCore; using vtCore.Interfaces; @@ -277,12 +279,13 @@ public int selectedFile get => _selectedFile; set => SetProperty(ref _selectedFile, value); } - int _selectedFile=0; + int _selectedFile = 0; public RelayCommand cmdAddFile { get; private set; } void doAddFile(object f) { string filename = f as String; + log.Info($"add additional file {filename}"); setup.additionalFiles.Add(filename); additionalFilesView.Refresh(); } @@ -292,6 +295,7 @@ void doDelFile(object o) { if (selectedFile >= 0) { + log.Info($"delete additional file {setup.additionalFiles[selectedFile]}"); setup.additionalFiles.RemoveAt(selectedFile); additionalFilesView.Refresh(); } @@ -309,10 +313,14 @@ public SetupTabVM(IProject project, SetupData setup) // additionalFiles = new ObservableCollection(setup.additionalFiles); additionalFilesView = CollectionViewSource.GetDefaultView(setup.additionalFiles); + + log.Info("constructed"); } private readonly SetupData setup; private readonly IProject project; + + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } } diff --git a/VisualTeensy/Views/Converters/EnumBooleanConverter.cs b/VisualTeensy/Views/Converters/EnumBooleanConverter.cs new file mode 100644 index 0000000..2aa5913 --- /dev/null +++ b/VisualTeensy/Views/Converters/EnumBooleanConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace VisualTeensy +{ + public class EnumBooleanConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value.Equals(parameter); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return ((bool)value) ? parameter : Binding.DoNothing; + } + } +} diff --git a/VisualTeensy/Views/ProjectTab.xaml b/VisualTeensy/Views/ProjectTab.xaml index 44fa4a3..ab60c04 100644 --- a/VisualTeensy/Views/ProjectTab.xaml +++ b/VisualTeensy/Views/ProjectTab.xaml @@ -22,6 +22,8 @@ d:DataContext="{d:DesignInstance vm:ProjectTabVM, IsDesignTimeCreatable=False}" d:DesignHeight="800" d:DesignWidth="1000"> + + @@ -55,12 +57,18 @@ d:DesignHeight="800" d:DesignWidth="1000"> - + Quick Setup uses your Arduino installation to generate the project. - + Expert Setup allows to choose the compiler and used core libraries independently of your Arduino installation. @@ -102,21 +110,29 @@ d:DesignHeight="800" d:DesignWidth="1000"> diff --git a/VisualTeensy/VisualTeensy.csproj b/VisualTeensy/VisualTeensy.csproj index 9736f34..491d31e 100644 --- a/VisualTeensy/VisualTeensy.csproj +++ b/VisualTeensy/VisualTeensy.csproj @@ -1,5 +1,6 @@  + Debug @@ -69,9 +70,7 @@ true - - Properties\app.manifest - + app.ico @@ -87,10 +86,16 @@ true + + + ..\packages\gong-wpf-dragdrop.1.1.0\lib\net46\GongSolutions.Wpf.DragDrop.dll + + ..\packages\LibGit2Sharp.0.26.2\lib\net46\LibGit2Sharp.dll + ..\packages\log4net.2.0.12\lib\net45\log4net.dll @@ -139,6 +144,7 @@ + @@ -314,7 +320,20 @@ if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)*.dll', '$(TargetDir)*.exe', '$(TargetDir)*.config' -DestinationPath '$(TargetDir)\VisualTeensy.zip' -Force) -