示例#1
0
        private ContextMenuStrip createMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            ToolStripMenuItem hideToolStripMenuItem = new ToolStripMenuItem("Ukryj");

            hideToolStripMenuItem.Click += (s, e) => { window.Hide(); };
            menu.Items.Add(hideToolStripMenuItem);

            ToolStripMenuItem restoreToolStripMenuItem = new ToolStripMenuItem("Przywróć");

            restoreToolStripMenuItem.Click += (s, e) => { window.Show(); };
            menu.Items.Add(restoreToolStripMenuItem);

            ToolStripMenuItem closeToolStripMenuItem = new ToolStripMenuItem("Zamknij");

            closeToolStripMenuItem.Click += (s, e) => { window.Close(); };
            menu.Items.Add(closeToolStripMenuItem);

            menu.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem aboutTheAutorToolStripMenuItem = new ToolStripMenuItem("O...");

            aboutTheAutorToolStripMenuItem.Click += (s, e) =>
            {
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("SplashScreen.png");
                splashScreen.Show(false, true);
                System.Threading.Thread.Sleep(1000);
                splashScreen.Close(new TimeSpan(0, 0, 1));
            };
            menu.Items.Add(aboutTheAutorToolStripMenuItem);
            return(menu);
        }
        private ContextMenuStrip tworzMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            ToolStripMenuItem ukryjToolStripMenuItem = new ToolStripMenuItem("Ukryj");

            ukryjToolStripMenuItem.Click += (s, e) => { okno.Hide(); };
            menu.Items.Add(ukryjToolStripMenuItem);

            ToolStripMenuItem przywrocToolStripMenuItem = new ToolStripMenuItem("Przywróć");

            przywrocToolStripMenuItem.Click += (s, e) => { okno.Show(); };
            menu.Items.Add(przywrocToolStripMenuItem);

            ToolStripMenuItem zamknijToolStripMenuItem = new ToolStripMenuItem("Zamknij");

            zamknijToolStripMenuItem.Click += (s, e) => { okno.Close(); };
            menu.Items.Add(zamknijToolStripMenuItem);

            menu.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem oAutorzeToolStripMenuItem = new ToolStripMenuItem("O...");

            oAutorzeToolStripMenuItem.Click += (s, e) =>
            {
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("SplashScreen.png");
                splashScreen.Show(false, true);
                System.Threading.Thread.Sleep(1000);
                splashScreen.Close(new TimeSpan(0, 0, 1));
            };
            menu.Items.Add(oAutorzeToolStripMenuItem);

            return(menu);
        }
示例#3
0
        public static void Main(string[] args)
        {
            Thread.CurrentThread.Name = "CMain";
            MyTraceContext.ThreadTraceContext = new MyTraceContext("Client");

            Trace.TraceInformation("Start");

            if (args.Contains("adventure"))
                ClientConfig.NewGameMode = GameMode.Adventure;
            else if (args.Contains("fortress"))
                ClientConfig.NewGameMode = GameMode.Fortress;

            StartupStopwatch = Stopwatch.StartNew();

            if (Debugger.IsAttached == false)
            {
                var splashScreen = new System.Windows.SplashScreen("Images/splash.png");
                splashScreen.Show(true, true);
            }

            var app = new App();
            app.InitializeComponent();
            app.Run();

            Trace.TraceInformation("Stop");
        }
示例#4
0
        private static void RunApp(ReadOnlyCollection <String> eventArgs)
        {
            if (eventArgs.Count == 0)
            {
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("resources/appstrackersplashresized.png");
                splashScreen.Show(true);
            }
            App app = new App(eventArgs);

            app.Run();
        }
示例#5
0
        public static void Main()
        {
            NvApiLoader.TryLoad();

            var splashBackground = new System.Windows.SplashScreen("Resources/Splash_Screen.png");

            splashBackground.Show(false, !Debugger.IsAttached);

            var uwpApp      = new UWP.App();
            var application = new App();

            application.InitializeComponent();
            application.Loaded += (object sender, EventArgs e) =>
            {
                splashBackground.Close(TimeSpan.FromMilliseconds(300));
            };
            application.Run();
        }
示例#6
0
        public static void Main(string[] args)
        {
            Program.StartupStopwatch = Stopwatch.StartNew();

            Thread.CurrentThread.Name = "CMain";
            MyTraceContext.ThreadTraceContext = new MyTraceContext("Client");

            Trace.TraceInformation("Start");

            if (Debugger.IsAttached == false)
            {
                var splashScreen = new System.Windows.SplashScreen("Images/splash.png");
                splashScreen.Show(true, true);
            }

            var app = new App();
            app.InitializeComponent();
            app.Run();

            Trace.TraceInformation("Stop");
        }
示例#7
0
        // Note: MultiDomain is faster when using separate appdomain for server
        // XXX MultiDomain doesn't seem to work with ClickOnce web install
        //[LoaderOptimization(LoaderOptimization.MultiDomain)]
        public static void Main(string[] args)
        {
            Program.StartupStopwatch = Stopwatch.StartNew();

            Thread.CurrentThread.Name         = "CMain";
            MyTraceContext.ThreadTraceContext = new MyTraceContext("Client");

            Trace.TraceInformation("Start");

            if (Debugger.IsAttached == false)
            {
                var splashScreen = new System.Windows.SplashScreen("Images/splash.png");
                splashScreen.Show(true, true);
            }

            var app = new App();

            app.InitializeComponent();
            app.Run();

            Trace.TraceInformation("Stop");
        }
示例#8
0
        /// <summary>
        /// Runs the application.
        /// </summary>
        /// <typeparam name="T">The type of the application's main window.</typeparam>
        /// <param name="uniqueInstance">A unique identifier for the application, used to enforce the single instance feature.</param>
        /// <param name="applicationInfo">The application description.</param>
        /// <param name="args">Command line arguments to the application.</param>
        /// <param name="splashScreenImage">Image to display in the splash screen.</param>
        public static void RunApplication <T>(string uniqueInstance, IApplicationInfo applicationInfo, string[] args, string splashScreenImage) where T : System.Windows.Window, new()
        {
            if (IsFirstInstance(uniqueInstance))
            {
                _mainWindowType       = typeof(T);
                _splashScreenResource = splashScreenImage;
                var splashScreen = new System.Windows.SplashScreen(splashScreenImage);
                splashScreen.Show(true, false);
                var app = new SingleInstanceApplication(applicationInfo);
                ////splashScreen.Close(TimeSpan.FromMilliseconds(444));
                var window = new T();
                app.MainWindow = window;

                // Should this be done in an OnImportsSatisfied instead? On Mac, it's done in the MainWindowController.
                var commandProviders = SingleInstanceApplication.Instance.CommandProviders;
                window.AddCommandsToMainWindow(commandProviders.Select(c => c.Value));

                app.Run(window);
            }
            else
            {
                ActivateOriginalInstance();
            }
        }
示例#9
0
        /// <summary>
        /// Импорт .xls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuFileOpen_Click(object sender, EventArgs e)
        {
            #region загрузка пользователем XLS
            //if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            //{
            //    string filename = openFileDialog.FileName;
            //    string extension = Path.GetExtension(filename);
            //    if (extension == ".xls" || extension == ".xlsx")
            //    {
            //        ExcelReader db = new ExcelReader(filename, true, false);
            //        TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList());

            //        if (t.ShowDialog(this) == DialogResult.OK)
            //        {
            //            DataTable tableSource = db.GetWorksheet(t.Selection);

            //            double[,] sourceMatrix = tableSource.ToMatrix(out sourceColumns);

            //            // Detect the kind of problem loaded.
            //            if (sourceMatrix.GetLength(1) == 2)
            //            {
            //                MessageBox.Show("Недостаточно данных");
            //            }
            //            else
            //            {
            //                this.dgvLearningSource.DataSource = tableSource;
            //                this.dgvTestingSource.DataSource = tableSource.Copy();

            //               // CreateScatterplot(graphInput, sourceMatrix);
            //            }
            //        }
            //    }
            //}
            #endregion
            #region быстрая загрузка
            string filename = ".//Resources//3.xls";

            string extension = Path.GetExtension(filename);

            ExcelReader db = new ExcelReader(filename, true, false);
            //ЛИСТЫ
            string[] sd = db.GetWorksheetList();

            TableSelectDialog t = new TableSelectDialog(sd);

            if (t.ShowDialog(this) == DialogResult.OK)
            {
                //заставка импорт
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("2.png");
                splashScreen.Show(true);

                DataTable tableSource = db.GetWorksheet(t.Selection);
                double[,] sourceMatrix = tableSource.ToMatrix(out sourceColumns);
                if (sourceMatrix.GetLength(1) == 2)
                {
                    MessageBox.Show("Недостаточно данных");
                }
                else
                {
                    this.dgvLearningSource.DataSource = tableSource;
                    this.dgvTestingSource.DataSource = tableSource.Copy();
                    // CreateScatterplot(graphInput, sourceMatrix);
                }
            }
            # endregion
        }
示例#10
0
        static int Main( string[] args )
        {
            System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();
              string[] resources = thisExe.GetManifestResourceNames();

            #if HK_ANARCHY
              System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen(thisExe, "SplashScreenAnarchy.png");
            #else
              System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen(thisExe, "SplashScreen.png");
            #endif
              splashScreen.Show(true);

              // should be the first thing to call.
              // This feature activates Group display in list views for instance.
              // Observe in the future: Is this the cause for any SEHException or strange UI behavior?

              Application.EnableVisualStyles();
              //Application.DoEvents(); // recommended in the web to avoid misc problems

              // set all possible types of culture type to avoid decimal comma in UI and prefab(!) .ToString functions
              CultureInfo culture = new System.Globalization.CultureInfo("en-US");

              // some of these are probably duplicates, but anyway...
              System.Threading.Thread.CurrentThread.CurrentCulture = culture;
              Application.CurrentCulture = culture;
              Thread.CurrentThread.CurrentCulture = culture;
              Thread.CurrentThread.CurrentUICulture = culture; // this seems responsible for number.ToString problems

              // register ManagedFramework tests in test manager
              TestSuiteBuilder testBuilder = new TestSuiteBuilder();
              TestSuite testSuiteManagedFrameWork = testBuilder.Build( typeof(ManagedFramework.VisionEngineManager).Assembly.FullName );
              TestManager.AddTestSuite(testSuiteManagedFrameWork);

              // register editor tests in test manager
              testBuilder = new TestSuiteBuilder();
              TestSuite testSuite = testBuilder.Build( typeof(EditorApp).Assembly.FullName );
              TestManager.AddTestSuite(testSuite);

              Form1.PreParseArgs(args);

              // this is our workaround:
              EditorManager.DesignMode = false;

              // we must ensure that the CWD is the EXE dir, otherwise we get lots of problems (bitmap files etc.)
              string sEXEDir = Application.StartupPath;
              Directory.SetCurrentDirectory(sEXEDir);

              Form1 form = new Form1();
              form.CommandLineArgs = args; // store them and parse them a bit later (first time in OnVisibleChanged)

              // Show warning about GC problems on first scene load (otherwise, warnings may not appear in the log view)
              bool shownGCWarning = false;
              EditorManager.SceneEvent += (o, e) =>
            {
              if (e.action != SceneEventArgs.Action.AfterLoading)
              {
            return;
              }

              if (shownGCWarning)
              {
            return;
              }

              shownGCWarning = true;
              // 64bit concurrent Workstation GC occasionally crashes (http://support.microsoft.com/kb/2679415). Server GC is not affected.
              // If the user overrides the settings in the app config xml, warn about the unsupported combination and force non-concurrent mode.
              if (IntPtr.Size == 8 && GCSettings.LatencyMode != GCLatencyMode.Batch && !System.Runtime.GCSettings.IsServerGC)
              {
            Log.Warning("The current C# GC mode has a known bug that can crash vForge (see http://support.microsoft.com/kb/2679415).");
            Log.Warning("vForge will now switch to a safer non-concurrent GC mode, which can affect application responsiveness.");
            Log.Warning("This can be avoided by using a 32bit version of vForge, or upgrading to .NET Framework 4.5 or later if your OS supports this.");
            GCSettings.LatencyMode = GCLatencyMode.Batch;
              }
              // The CLR may fallback to Workstation non-concurrent if Server concurrent is not supported (ie. single core machines or .NET <= 4.0).
              else if (GCSettings.LatencyMode == GCLatencyMode.Batch)
              {
            Log.Warning("vForge is currently running under a non-concurrent C# GC mode that can affect application responsiveness.");
            Log.Warning("For best performance, it's recommended to run vForge on a multi-core machine with .NET Framework 4.5 or later.");
              }
            };

            #if (!DEBUG)
              AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Domain_UnhandledException);
              Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

              try
            #endif
              {
            // run application
            Application.Run(form);
              }
            #if (!DEBUG)
              catch (Exception ex)
              {
            EditorManager.DumpException(ex, true);
              }
            #endif

              EditorApp.DeinitEditorApp();

              if (g_triggerTests)
            return (g_testResult ? 0 : -1);

              return 0;
        }