Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // To Do Disabled 2017-06-22 maybe this shouldn't be disabled
            //if ( mutex.WaitOne ( TimeSpan.Zero , true ) )
            if (true)
            {
                //mutex.ReleaseMutex ( );

                CurrentChampionship = new ChampionshipVM( );

                base.OnStartup(e);

                controls = new ObservableCollection <MainPageControl> ( );

                if (e.Args.Count( ) > 0)
                {
                    if (e.Args[0].ToLower( ).EndsWith(".csdb"))
                    {
                        string OpenFilePath = e.Args[0];

                        onLoadFile = OpenFilePath;
                    }
                    else
                    {
                        ChampionshipSolutions.Diag.Diagnostics.LogLine("Tried to open invalid file", ChampionshipSolutions.Diag.MessagePriority.Critical);
                        ChampionshipSolutions.Diag.Diagnostics.LogLine(e.Args[0].ToString( ), ChampionshipSolutions.Diag.MessagePriority.Critical);
                    }
                }
            }

            //else {

            //    if ( e.Args.Count ( ) > 0 )
            //    {
            //        ChampionshipSolutions.Diag.Diagnostics.LogLine ( "Tried to open file on non main application" , ChampionshipSolutions.Diag.MessagePriority.Critical );
            //        foreach ( string s in e.Args )
            //            ChampionshipSolutions.Diag.Diagnostics.LogLine ( s , ChampionshipSolutions.Diag.MessagePriority.Critical );
            //    }

            //    // send our Win32 message to make the currently running instance
            //    // jump on top of all the other windows
            //    NativeMethods.PostMessage(
            //        (IntPtr) NativeMethods.HWND_BROADCAST ,
            //        NativeMethods.WM_SHOWME ,
            //        IntPtr.Zero ,
            //        IntPtr.Zero );
            //    Application.Current.Shutdown( );
            //}

            // here you take control
        }
Beispiel #2
0
 public void setChampionship(ChampionshipVM Championship)
 {
     DataContext = Championship;
 }