Ejemplo n.º 1
0
        private void openDirectoryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            OpenDirectoryArgument argument = (OpenDirectoryArgument)e.Argument;
            ServerConfigAdapter   sca      = CreateAdapter <ServerConfigAdapter>();

            OpenDirectoryResult result = new OpenDirectoryResult {
                StatusGuid = argument.StatusGuid
            };

            if (sca.WindowsServerName == Environment.MachineName)
            {
                result.DirectoryIsLocal = true;
                result.DirectoryPath    = argument.SelectedWebsite.GetDirectory(sca.WebsiteDirectory.FullName);
            }
            e.Result = result;
        }
Ejemplo n.º 2
0
        private void openDirectoryBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            OpenDirectoryResult result = (OpenDirectoryResult)e.Result;

            AsyncStatusRevert(result.StatusGuid);

            if (e.Error != null)
            {
                throw new Exception("Could not open website directory.", e.Error);
            }

            if (result.DirectoryIsLocal)
            {
                Process.Start(result.DirectoryPath);
            }
            else
            {
                MessageBox.Show(
                    "The website path is not local to this server (" +
                    Environment.MachineName + ") and so cannot be opened.",
                    "Path not local", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }