コード例 #1
0
        /// <summary>
        /// Initializes the <see cref="TraceLabApplication"/> class.
        /// </summary>
        static TraceLabApplication()
        {
            ComponentDirectories = new List <string>();
            TypeDirectories      = new List <string>();
            PackageDirectories   = new List <string>();
            PackagesToInstall    = new List <string>();

            Processor = new CommandLineProcessor();
            //    SetExperimentFileToBeOpen ( "C:"+System.IO.Path.DirectorySeparatorChar+"Users"+Path.DirectorySeparatorChar+"emanuele.forlano"+Path.DirectorySeparatorChar+"Desktop"+Path.DirectorySeparatorChar+"traelab-deploy"+Path.DirectorySeparatorChar+"WINDOWS"+Path.DirectorySeparatorChar+"twhile.teml");

            Processor.Commands["o"]    = new Action <string>(SetExperimentFileToBeOpen);
            Processor.Commands["open"] = new Action <string>(SetExperimentFileToBeOpen);

            Processor.Commands["c"]          = new Action <string>(SetComponentsDirectory);
            Processor.Commands["components"] = new Action <string>(SetComponentsDirectory);

            Processor.Commands["t"]     = new Action <string>(SetTypesDirectory);
            Processor.Commands["types"] = new Action <string>(SetTypesDirectory);

            Processor.Commands["p"]        = new Action <string>(SetPackagesDirectory);
            Processor.Commands["packages"] = new Action <string>(SetPackagesDirectory);

            Processor.Commands["d"]         = new Action <string>(SetDecisionsDirectory);
            Processor.Commands["decisions"] = new Action <string>(SetDecisionsDirectory);

            Processor.Commands["w"]         = new Action <string>(SetWorkspaceDirectory);
            Processor.Commands["workspace"] = new Action <string>(SetWorkspaceDirectory);

            Processor.Commands["x"]     = new Action <string>(SetCacheDirectory);
            Processor.Commands["cache"] = new Action <string>(SetCacheDirectory);

            Processor.Commands["base"] = new Action <string>(SetBaseDirectory);

            Processor.Commands["?"] = new Action <string>(DisplayCommandLineHelp);

            Processor.Commands["installpackage"] = new Action <string>(InstallPackage);
        }
コード例 #2
0
ファイル: TraceLabApplication.cs プロジェクト: thbin/TraceLab
        /// <summary>
        /// Initializes the <see cref="TraceLabApplication"/> class.
        /// </summary>
        static TraceLabApplication()
        {
            ComponentDirectories = new List <string>();
            TypeDirectories      = new List <string>();
            PackageDirectories   = new List <string>();
            PackagesToInstall    = new List <string>();

            Processor = new CommandLineProcessor();

            Processor.Commands["o"]    = new Action <string>(SetExperimentFileToBeOpen);
            Processor.Commands["open"] = new Action <string>(SetExperimentFileToBeOpen);

            Processor.Commands["c"]          = new Action <string>(SetComponentsDirectory);
            Processor.Commands["components"] = new Action <string>(SetComponentsDirectory);

            Processor.Commands["t"]     = new Action <string>(SetTypesDirectory);
            Processor.Commands["types"] = new Action <string>(SetTypesDirectory);

            Processor.Commands["p"]        = new Action <string>(SetPackagesDirectory);
            Processor.Commands["packages"] = new Action <string>(SetPackagesDirectory);

            Processor.Commands["d"]         = new Action <string>(SetDecisionsDirectory);
            Processor.Commands["decisions"] = new Action <string>(SetDecisionsDirectory);

            Processor.Commands["w"]         = new Action <string>(SetWorkspaceDirectory);
            Processor.Commands["workspace"] = new Action <string>(SetWorkspaceDirectory);

            Processor.Commands["x"]     = new Action <string>(SetCacheDirectory);
            Processor.Commands["cache"] = new Action <string>(SetCacheDirectory);

            Processor.Commands["base"] = new Action <string>(SetBaseDirectory);

            Processor.Commands["?"] = new Action <string>(DisplayCommandLineHelp);

            Processor.Commands["installpackage"] = new Action <string>(InstallPackage);
        }
コード例 #3
0
        /// <summary>
        /// Signals the external first application instance.
        /// It is being executed if TraceLab is already running, and user attempts to 
        /// open TraceLab again. See SingleInstance.InitializeAsFirstInstance
        /// </summary>
        /// <param name="args">The args.</param>
        public static void SignalExternalFirstApplicationInstance(IList<string> args)
        {
            // Detect if we're running in Mono - if not, then we can use WPF
            Type t = Type.GetType("Mono.Runtime");
            if (t == null)
            {
                CommandLineProcessor processor = new CommandLineProcessor();

                string experimentFilename = null;
                processor.Commands["o"] = delegate(string value) { experimentFilename = value; };
                processor.Commands["open"] = delegate(string value) { experimentFilename = value; };

                processor.Parse(args.ToArray());

                if (String.IsNullOrEmpty(experimentFilename) == false)
                {
                    OpenNewExperiment(MainViewModel, experimentFilename);
                }
            }
            else
            {
                System.Diagnostics.Trace.Write("Application already running! Currently sending the command args to currently running non-wpf application is not supported");
                throw new NotImplementedException("Application already running! Currently sending the command args to currently running non-wpf application is not supported");
            }
        }