Exemplo n.º 1
0
        internal static void GetScriptDir()
        {
            var ofd = new OpenFileDialog {
                AddExtension = true, DefaultExt = "py", FileName = "NORway.py", Filter = Resources.FilterPy, Title = Resources.SelectNORwayOrNANDWay
            };

            ofd.FileOk += delegate(object sender, CancelEventArgs args) {
                var path = Path.GetDirectoryName(ofd.FileName);
                if (path == null)
                {
                    args.Cancel = true;
                }
                if (!File.Exists(path + "\\NORway.py"))
                {
                    args.Cancel = true;
                }
                if (!File.Exists(path + "\\NANDway.py"))
                {
                    args.Cancel = true;
                }
            };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                PythonHandler.WorkingDirectory = Path.GetDirectoryName(ofd.FileName);
                if (!RegistryStuff.SaveScriptDirectory(PythonHandler.WorkingDirectory))
                {
                    MessageBox.Show(Resources.ErrorWhileSavingScriptPath, Resources.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(Resources.SelectNORwayAndNANDWayInTools);
            }
        }
Exemplo n.º 2
0
 [STAThread] static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Mainform = new MainForm();
     if (!RegistryStuff.GetPythonPath(out PythonHandler.PythonPath))
     {
         GetPythonPath();
     }
     if (!RegistryStuff.GetScriptDirectory(out PythonHandler.WorkingDirectory))
     {
         GetScriptDir();
     }
     Application.Run(Mainform);
 }