"Please load a file or create a new Army" message

Started by Mickey3D, August 21, 2018, 03:33:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mickey3D

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.


Mickey3D

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é arrêté en raison d'une exception non gérée.
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()


Andy ONeill

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.

Mickey3D

#3
QuoteThe 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.

Mickey3D

QuoteWith the first one then you should disable the deletion of the top node

I've just realized it is already the case  :-".

Andy ONeill

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.