GrogHeads Forum

Grog Friends and Affiliates => General Staff Support Forum => Army Editor Tech Support => Topic started by: Mickey3D on August 21, 2018, 02:33:02 PM

Title: "Please load a file or create a new Army" message
Post by: Mickey3D on August 21, 2018, 02:33:02 PM
A small detail but I think the message "Please load a file or create a new Army" when you open the editor should not be overwritable.

Title: Re: "Please load a file or create a new Army" message
Post by: Mickey3D on August 21, 2018, 02:40:26 PM
Well, it might be a problem : I'm able to save the file and if I open it the editor crashes.

Error in Windows event log:
Quote
Application : GSBPArmyEditor.exe
Version du Framework : v4.0.30319
Description : le processus a t arrt en raison d'une exception non gre.
Informations sur l'exception : System.ArgumentOutOfRangeException
    System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument, System.ExceptionResource)
    System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Item(Int32)
    ArmyEditor.MainWindowViewModel.LoadArmy(System.String)
    ArmyEditor.MainWindowViewModel.<get_OpenArmyCommand>b__40_0()

Informations sur l'exception : System.Reflection.TargetInvocationException
    System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
    System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
    System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
    GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
    GalaSoft.MvvmLight.CommandWpf.RelayCommand.Execute(System.Object)
    MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean)
    System.Windows.Controls.MenuItem.InvokeClickAfterRender(System.Object)
    System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
    System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
    System.Windows.Threading.DispatcherOperation.InvokeImpl()
    MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
    System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
    System.Windows.Threading.DispatcherOperation.Invoke()
    System.Windows.Threading.Dispatcher.ProcessQueue()
    System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
    MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
    MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
    System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
    System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
    System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
    MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
    MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
    System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
    System.Windows.Application.RunDispatcher(System.Object)
    System.Windows.Application.RunInternal(System.Windows.Window)
    ArmyEditor.App.Main()

Title: Re: "Please load a file or create a new Army" message
Post by: Andy ONeill on August 22, 2018, 03:49:29 AM
Yes, if you just hit save then I think you'll get pretty much an empty file.
I'll think about this one a bit.
The potential to produce a file which'll error is the part which I think is particularly bad.

The easiest way is probably to start you off with a top level HQ there already.
If you hit save and re-load you wouldn't get an error.


OTOH I could disable save options if there are zero units added.
That still leaves hiding and showing some label.
Title: Re: "Please load a file or create a new Army" message
Post by: Mickey3D on August 22, 2018, 01:43:40 PM
Quote
The easiest way is probably to start you off with a top level HQ there already.
If you hit save and re-load you wouldn't get an error.

OTOH I could disable save options if there are zero units added.
That still leaves hiding and showing some label.

Both are valid options. With the first one then you should disable the deletion of the top node.
Title: Re: "Please load a file or create a new Army" message
Post by: Mickey3D on August 22, 2018, 02:19:19 PM
Quote
With the first one then you should disable the deletion of the top node

I've just realized it is already the case  :-".
Title: Re: "Please load a file or create a new Army" message
Post by: Andy ONeill on August 23, 2018, 03:12:54 AM
Yes, you can't delete the general.

I've implemented the first option and you're straight into starting an army with a General when you start the app up.
I think this is better for the new user anyhow since an empty window is pretty intimidating when you first run something.