Пример #1
0
        /// <summary>
        /// Load a file after prompting in a dialog box.
        /// </summary>
        /// <param name="defaultpath">Default path for loading from.</param>
        /// <returnsTrue if file was loaded, false on error or cancel</returns>
        public static bool LoadPointsFile(OgreForm _owner)
        {
            owner = _owner;

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = Registry.GetLastPath();
            openFileDialog1.Filter           = FileFilter;
            openFileDialog1.FilterIndex      = Registry.GetLastFileFilter();
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                LastPointFile = openFileDialog1.FileName;

                // Spawn a thread to do the parsing and calibration so GUI doesn't hang.
                Thread myThread = new Thread(() => ParsingThread());
                myThread.Start();

                Registry.WriteRegistry(Path.GetDirectoryName(LastPointFile), openFileDialog1.FilterIndex);

                return(true);
            }
            return(false);
        }
Пример #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            OgreForm form = new OgreForm();

            form.Init();
            form.Go();
        }
Пример #3
0
        public NetworkListener(OgreForm owner)
        {
            this.owner = owner;

            IPAddress myAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);

            if (myAddress != null)
            {
                server = new TcpListener(myAddress, 5000);
            }
            else
            {
                server = new TcpListener(IPAddress.Any, 5000);
            }
        }