public PickTargetOutputTypeWindow(Window owner, OutputTargetSectionViewModel viewModel)
     : base(owner)
 {
     InitializeComponent();
     Title = "Select type";
     DataContext = this;
     IOutputTargetViewModel libraryVm = viewModel.Targets.First(vm => vm.Type == OutputTargetType.Library);
     if(libraryVm.IsAutoGenerated)
     {
         Targets = new OutputTargetType[]
         {
             OutputTargetType.Library,
             OutputTargetType.Binary,
             OutputTargetType.Benchmark,
             OutputTargetType.Test,
             OutputTargetType.Example
         };
     }
     else
     {
         Targets = new OutputTargetType[]
         {
             OutputTargetType.Binary,
             OutputTargetType.Benchmark,
             OutputTargetType.Test,
             OutputTargetType.Example
         };
     }
     SelectedTarget = Targets[0];
 }
Exemplo n.º 2
0
        public static bool DefaultTest(this OutputTargetType type)
        {
            switch (type)
            {
            default:
                return(true);

            case OutputTargetType.Benchmark:
                return(false);
            }
        }
Exemplo n.º 3
0
        public static bool DefaultDoctest(this OutputTargetType type)
        {
            switch (type)
            {
            default:
                return(false);

            case OutputTargetType.Library:
                return(true);
            }
        }
Exemplo n.º 4
0
        public static bool DefaultBench(this OutputTargetType type)
        {
            switch (type)
            {
            default:
                return(true);

            case OutputTargetType.Test:
            case OutputTargetType.Example:
                return(false);
            }
        }
Exemplo n.º 5
0
        public static string DefaultPath(this OutputTargetType type, string name)
        {
            switch (type)
            {
            case OutputTargetType.Library:
                return(String.Format(@"src\{0}.rs", name));

            case OutputTargetType.Binary:
                return(String.Format(@"src\{0}.rs", name));

            case OutputTargetType.Benchmark:
                return(String.Format(@"benches\{0}.rs", name));

            case OutputTargetType.Test:
                return(String.Format(@"tests\{0}.rs", name));

            case OutputTargetType.Example:
                return(String.Format(@"examples\{0}.rs", name));
            }
            throw new ArgumentException(null, "type");
        }
Exemplo n.º 6
0
        public static string ToTypeString(this OutputTargetType type)
        {
            switch (type)
            {
            case OutputTargetType.Library:
                return("lib");

            case OutputTargetType.Binary:
                return("bin");

            case OutputTargetType.Benchmark:
                return("bench");

            case OutputTargetType.Test:
                return("test");

            case OutputTargetType.Example:
                return("example");
            }
            throw new ArgumentException(null, "type");
        }
Exemplo n.º 7
0
 static OutputTarget GetOutputTarget(IReadOnlyList<OutputTarget> targets, OutputTargetType type, string name)
 {
     return targets.First(t => t.Type == type && t.Name == name);
 }
Exemplo n.º 8
0
 protected object GetOutputTarget(OutputTargetType targetType)
 {
     return(null);
 }
Exemplo n.º 9
0
 public OutputTarget(OutputTargetType type)
 {
     Type   = type;
     Handle = null;
 }
Exemplo n.º 10
0
 public static bool DefaultHarness(this OutputTargetType _)
 {
     return(true);
 }
Exemplo n.º 11
0
 public static bool DefaultPlugin(this OutputTargetType _)
 {
     return(false);
 }