本文整理汇总了C#中Program类的典型用法代码示例。如果您正苦于以下问题:C# Program类的具体用法?C# Program怎么用?C# Program使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Program类属于命名空间,在下文中一共展示了Program类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
var program = new Program();
Mapper.CreateMap<Customer, CustomerViewItem>();
Stopwatch watch = new Stopwatch();
for (int x = 1; x <= 100000; x *= 10)
{
program.PopulateCustomers(x);
watch.Start();
program.RunMapper(x);
watch.Stop();
Console.WriteLine(string.Format("AutoMapper with {0}: {1}", x, watch.ElapsedMilliseconds));
watch.Reset();
watch.Start();
program.RunManual(x);
watch.Stop();
Console.WriteLine(string.Format("Manual Map with {0}: {1}", x, watch.ElapsedMilliseconds));
}
Console.ReadLine();
}
示例2: DisassemblyTextModel
public DisassemblyTextModel(Program program)
{
if (program == null)
throw new ArgumentNullException("program");
this.program = program;
this.position = program.Image.BaseAddress;
}
示例3: DeleteProgram
public bool DeleteProgram(Program program)
{
if (program == null) return false;
_unitOfWork.ProgramRepository.Delete(program);
_unitOfWork.Save();
return true;
}
示例4: SendData
///<summary>Launches the program using a combination of command line characters and the patient.Cur data.</summary>
public static void SendData(Program ProgramCur,Patient pat)
{
//Example CerPI.exe -<patNum>;<fname>;<lname>;<birthday DD.MM.YYYY>; (Date format specified in the windows Regional Settings)
if(pat==null) {
try {
Process.Start(ProgramCur.Path);//should start Cerec without bringing up a pt.
}
catch {
MessageBox.Show(ProgramCur.Path+" is not available.");
}
return;
}
string info= " -" ;
if(ProgramProperties.GetPropVal(ProgramCur.ProgramNum,"Enter 0 to use PatientNum, or 1 to use ChartNum")=="0") {
info+=pat.PatNum.ToString()+";";
}
else {
info+=pat.ChartNumber.ToString()+";";
}
info+=pat.FName+";"+pat.LName+";"+pat.Birthdate.ToShortDateString()+";";
try {
Process.Start(ProgramCur.Path,info);
}
catch {
MessageBox.Show(ProgramCur.Path+" is not available, or there is an error in the command line options.");
}
}
示例5: SendData
///<summary></summary>
public static void SendData(Program ProgramCur,Patient pat) {
_path=Programs.GetProgramPath(Programs.GetCur(ProgramName.DemandForce));
if(!File.Exists(_path)) {
MessageBox.Show(_path+" could not be found.");
return;
}
if(MessageBox.Show(Lan.g("DemandForce","This may take 20 minutes or longer")+". "+Lan.g("DemandForce","Continue")+"?","",MessageBoxButtons.OKCancel)!=DialogResult.OK) {
return;
}
_formProg=new FormProgress();
_formProg.MaxVal=100;
_formProg.NumberMultiplication=1;
_formProg.DisplayText="";
_formProg.NumberFormat="F";//Show whole percentages, not fractional percentages.
Thread workerThread=new Thread(new ThreadStart(InstanceBridgeExport));
workerThread.Start();
if(_formProg.ShowDialog()==DialogResult.Cancel) {
workerThread.Abort();
MessageBox.Show(Lan.g("DemandForce","Export cancelled")+". "+Lan.g("DemandForce","Partially created file has been deleted")+".");
CheckCreatedFile(CodeBase.ODFileUtils.CombinePaths(Path.GetDirectoryName(_path),"extract.xml"));
_formProg.Dispose();
return;
}
MessageBox.Show(Lan.g("DemandForce","Export complete")+". "+Lan.g("DemandForce","Press OK to launch DemandForce")+".");
try {
Process.Start(_path);//We might have to add extract.xml to launch command in the future.
}
catch {
MessageBox.Show(_path+" is not available.");
}
_formProg.Dispose();
}
示例6: Main
/// <summary>
/// Start the console server.
/// </summary>
/// <param name="args">These are optional arguments.Pass the local ip address of the server as the first argument and the local port as the second argument.</param>
public static void Main(string[] args)
{
var progDomain = new Program {_clients = new List<ClientManager>()};
if (args.Length == 0)
{
progDomain._serverPort = 8000;
progDomain._serverIp = IPAddress.Any;
}
if (args.Length == 1)
{
progDomain._serverIp = IPAddress.Parse(args[0]);
progDomain._serverPort = 8000;
}
if (args.Length == 2)
{
progDomain._serverIp = IPAddress.Parse(args[0]);
progDomain._serverPort = int.Parse(args[1]);
}
progDomain._bwListener = new BackgroundWorker {WorkerSupportsCancellation = true};
progDomain._bwListener.DoWork += progDomain.StartToListen;
progDomain._bwListener.RunWorkerAsync();
Console.WriteLine("*** Listening on port {0}{1}{2} started.Press ENTER to shutdown server. ***\n", progDomain._serverIp, ":", progDomain._serverPort);
Console.ReadLine();
progDomain.DisconnectServer();
}
示例7: Main
static void Main(string[] args)
{
var p = new Program();
p.UseIdentityMonad();
p.UseMaybeMonad();
Console.ReadLine();
}
示例8: Main
private static void Main(string[] args)
{
Program p = new Program();
string userSelectedOption = "";
do
{
userSelectedOption = p.GetUserInput();
switch (userSelectedOption)
{
case "1":
p.DisplayOrders();
break;
case "2":
p.AddAnOrder();
break;
case "3":
p.EditAnOrder();
break;
case "4":
p.RemoveAnOrder();
break;
case "5":
break;
default:
Console.Clear();
Console.WriteLine("Thats not a valid choice. Please select again");
Console.WriteLine("");
break;
}
} while (userSelectedOption != "5");
}
示例9: init
public void init(int programID, AxMapControl mc, AxToolbarControl tc, MainWindow mw)
{
inited = true;
program = new Program();
program.id = programID;
program.select();
mapControl = mc;
toolbarControl = tc;
mainWindow = mw;
mainRoadList = program.getAllRelatedMainRoad();
if (mainRoadList == null)
mainRoadList = new ObservableCollection<MainRoad>();
foreach (MainRoad mainRoad in mainRoadList)
{
GisUtil.DrawPolylineElement(mainRoad.lineElement, mapControl);
}
valid = isValid();
dirty = false;
mapControlMouseDown = null;
MainRoadListBox.ItemsSource = mainRoadList;
}
示例10: MainState
public MainState(Program handle)
: base(handle,TypeState.Normal)
{
_arrayState = new State[9];
string disconnect = "(disconnect)";
_menu = new Menu(MainHandle.Display_N18);
_menu.Title = "SDK Gadgeteer";
_menu.Lines[0] = "On/off Button led";
_menu.Lines[1] = "Demo Joystick";
_menu.Lines[2] = "Demo Timer";
_menu.Lines[3] = "Demo SDCard";
_menu.Lines[4] = "Demo Tunes";
_menu.Lines[5] = "Demo Led Strip";
_menu.Lines[6] = "Demo Screen";
_menu.Lines[7] = "Item7";
_menu.Lines[8] = "Infos,versions,...";
if (MainHandle.Tunes == null)
_menu.Lines[4] += disconnect;
if (MainHandle.LED_Strip == null)
_menu.Lines[5] += disconnect;
_menu.Draw();
}
示例11: Main
static void Main(string[] args)
{
System.Console.WriteLine("OMGHAI!");
var app = new Program()
{
Items = new List<Item>
{
new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80},
new Item
{
Name = "Backstage passes to a TAFKAL80ETC concert",
SellIn = 15,
Quality = 20
},
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
}
};
app.UpdateQuality();
System.Console.ReadKey();
}
示例12: RunTest
protected override void RunTest(Program program, string outputFile)
{
var eventListener = new FakeDecompilerEventListener();
using (FileUnitTester fut = new FileUnitTester(outputFile))
{
fut.TextWriter.WriteLine("// Before ///////");
DumpProgram(program, fut.TextWriter);
SetupPreStages(program);
aen.Transform(program);
eqb.Build(program);
var coll = new TypeCollector(program.TypeFactory, program.TypeStore, program,eventListener);
coll.CollectTypes();
program.TypeStore.BuildEquivalenceClassDataTypes(program.TypeFactory);
tvr.ReplaceTypeVariables();
trans.Transform();
ctn.RenameAllTypes(program.TypeStore);
ter = new TypedExpressionRewriter(program, eventListener);
try
{
ter.RewriteProgram(program);
}
catch (Exception ex)
{
fut.TextWriter.WriteLine("** Exception **");
fut.TextWriter.WriteLine(ex);
}
finally
{
fut.TextWriter.WriteLine("// After ///////");
DumpProgAndStore(program, fut);
}
}
}
示例13: Main
static void Main()
{
var generator = new Program();
generator.RebuildGitParser();
generator.RebuildGitNumstatParser();
}
示例14: Main
static void Main(string[] args)
{
var program = new Program();
Dictionary<string, bool[]> dados = new Dictionary<string, bool[]>
{
{"peixe", new[]{true,false,false,false}},
{"cachorro", new[]{false,false,true,false}},
{"cobra", new[]{false,false,false,true}},
{"tucano", new[]{false,true,false,false}},
{"batima", new[]{false,true,true,false}},
};
var perguntas = new[]
{
"Ele nada?",
"Ele voa?",
"É um mamífero?",
"É um reptil?",
};
Console.WriteLine("Pense em um animal e tecle alguma coisa...");
Console.ReadKey();
bool[] respostas = program.ColetaRespostas(perguntas);
var animal = program.DescobrirAnimal(dados, respostas);
Console.WriteLine(animal);
Console.ReadKey();
}
示例15: Translate
public static List<Error> Translate(Source source)
{
var err = new List<Error>();
var prg = new Program();
try
{
var input = new ANTLRStringStream(source.GetSourceData());
var lexer = new PascalLexer(input);
var tokens = new CommonTokenStream(lexer);
var parser = new PascalParser(tokens);
prg = parser.program();
prg.SetSourceIdentifier(source.GetSourceIdentifier());
}
catch (RecognitionException e)
{
err.Add(new Error(FormatRecognitionException(e, source.GetSourceIdentifier())));
}
if (err.Count != 0)
return err;
var val = new Validator();
err = val.Validate(prg);
Root = prg;
return err;
}