/***************************/ /* LoadConstructs_Executed */ /***************************/ private void LoadConstructs_Executed( object sender, ExecutedRoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Constructs Files (*.clp)|*.clp|All Files (*.*)|*.*"; String currentDirectory = preferences.GetCurrentDirectory(); if (Directory.Exists(currentDirectory)) { openFileDialog.InitialDirectory = currentDirectory; } openFileDialog.Title = "Load Constructs"; if (openFileDialog.ShowDialog() != true) { return; } String dirPath = Path.GetDirectoryName(openFileDialog.FileName); String fileName = Path.GetFileName(openFileDialog.FileName); preferences.SaveCurrentDirectory(dirPath); this.SetCurrentDirectory(dirPath); dialog.ReplaceCommand("(load \"" + fileName + "\")\n"); }
/**************/ /* MainWindow */ /**************/ public MainWindow() { InitializeComponent(); preferences = new IDEPreferences(); String currentDirectory = preferences.GetCurrentDirectory(); if (Directory.Exists(currentDirectory)) { this.SetDirectory(currentDirectory); } else { this.SetDirectory(Directory.GetCurrentDirectory()); } }
/**************/ /* MainWindow */ /**************/ public MainWindow() { InitializeComponent(); preferences = new IDEPreferences(); String currentDirectory = preferences.GetCurrentDirectory(); if (Directory.Exists(currentDirectory)) { this.SetCurrentDirectory(currentDirectory); } else { this.SetCurrentDirectory(Directory.GetCurrentDirectory()); } agendaBrowserManager = new AgendaBrowserManager(this); factBrowserManager = new FactBrowserManager(this); instanceBrowserManager = new InstanceBrowserManager(this); IDEPeriodicCallback theCB = new IDEPeriodicCallback(this); this.dialog.GetEnvironment().AddPeriodicCallback("IDECallback", 0, theCB); this.dialog.GetEnvironment().EnablePeriodicFunctions(true); this.dialog.GetEnvironment().AddUserFunction("clear-window", "v", 0, 0, null, new ClearWindowFunction(this)); this.dialog.StartCommandEvent += new StartCommandDelegate(StartExecutionEventOccurred); this.dialog.FinishCommandEvent += new FinishCommandDelegate(FinishExecutionEventOccurred); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += IDEPeriodicTimer; dispatcherTimer.Interval = TimeSpan.FromMilliseconds(500); dispatcherTimer.Start(); }