本文整理汇总了C#中Monitor类的典型用法代码示例。如果您正苦于以下问题:C# Monitor类的具体用法?C# Monitor怎么用?C# Monitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Monitor类属于命名空间,在下文中一共展示了Monitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
static void Init(string programPath)
{
client = new TenhouClient("aixile");
gameEnd.Reset();
client.OnLogin += () =>
{
//client.EnterLobby(0);
client.Join(GameType.North);
client.Join(GameType.North_fast);
client.Join(GameType.East);
client.Join(GameType.East_fast);
};
client.OnGameEnd += () => { gameEnd.Set(); };
client.OnClose += () => { gameEnd.Set(); };
monitor = new Monitor(client);
monitor.Start();
controller = new Controller(client, programPath);
controller.Start();
client.Login();
}
示例2: Main
public static int Main(String[] args)
{
Monitor monitor = new Monitor();
SocketListener listener = new SocketListener(monitor);
listener.startListening();
return 0;
}
示例3: Main
private static void Main(string[] args)
{
//string filename =
// @"..\..\..\Dev.ProcessMonitor.TestTargerExe\bin\Debug\Dev.ProcessMonitor.TestTargerExe.exe";
//string arg = "";
////string filename =
//// @"..\..\..\Dev.ProcessMonitor.FormTest\bin\Debug\Dev.ProcessMonitor.FormTest.exe";
////string arg = "";
//var starter = new ProcessStarterAsyn(filename, arg);
//starter.StandardErrorOut += starter_StandardErrorOut;
//starter.StandardOut += starter_StandardOut;
//starter.StartAsyn();
//Console.WriteLine("pressanykey");
var m = new Monitor(true);
m.StandardErrorOut += m_StandardErrorOut;
m.Start();
Console.ReadKey();
m.Stop();
}
示例4: OnStart
protected override void OnStart(string[] args)
{
m = new Monitor(true);
m.StandardErrorOut += m_StandardErrorOut;
m.StandardOut += m_StandardOut;
m.Start();
}
示例5: ToString
public override string ToString()
{
g = (Monitor)base.Tag;
Binding myBinding = new Binding("ext");
myBinding.Mode = BindingMode.TwoWay;
myBinding.Source = g;
txtext.SetBinding(TextBox.TextProperty, myBinding);
Binding myBinding2 = new Binding("basename");
myBinding2.Mode = BindingMode.TwoWay;
myBinding2.Source = g;
txtbase.SetBinding(TextBox.TextProperty, myBinding2);
Binding myBinding3 = new Binding("flags");
myBinding3.Mode = BindingMode.TwoWay;
myBinding3.Source = g;
txtflags.SetBinding(TextBox.TextProperty, myBinding3);
Binding descbinding = new Binding("Description");
descbinding.Mode = BindingMode.TwoWay;
descbinding.Source = g;
txtdesc.SetBinding(TextBox.TextProperty, descbinding);
return base.ToString();
}
示例6: OnePassDataIndexer
/// <summary>
/// Initializes a new instance of the <see cref="OnePassDataIndexer"/> class, using a event stream, a cutoff value and a value that indicates if the events should be sorted.
/// </summary>
/// <param name="eventStream">The event stream.</param>
/// <param name="cutoff">The cutoff.</param>
/// <param name="sort">if set to <c>true</c> the events will be sorted during the indexing.</param>
/// <param name="monitor">The evaluation monitor.</param>
public OnePassDataIndexer(IObjectStream<Event> eventStream, int cutoff, bool sort, Monitor monitor)
: base(monitor) {
EventStream = eventStream;
Cutoff = cutoff;
Sort = sort;
}
示例7: MainPage
public MainPage()
{
this.InitializeComponent ();
this.teams = new TeamCollection ();
this.attacks = new AttackCollection (this.LayoutCanvas);
this.allocators =
new AllocatorClassifier (new [] {
typeof (CircleAllocator),
typeof (RectangleAllocator),
typeof (GridAllocator)
});
this.monitor = new Monitor ();
this.lock_object = new object ();
this.service_names = new List <string> ();
this.windowSize = new Size (this.LayoutCanvas.Width, this.LayoutCanvas.Height);
this.speed = (int) this.speedSlider.Value + 1;
this.realtimeMode = this.realtime.IsChecked == true;
this.begin_with_realtime = false;
this.play_iter = 0;
this.update_interval = 10;
foreach (var allocator in this.allocators)
this.Allocation.Items.Add (allocator.Name);
this.Allocation.SelectedIndex = this.allocators.Index;
}
示例8: AddMonitor
//public void AddBattery(Battery battery)
//{
// using (var db = new ShopContext())
// {
// var tmp = (from entity in db.Carts
// where entity.GoodsId == battery.Id
// where entity.GoodsCategory == "battery"
// select entity).FirstOrDefault();
// if (tmp == null)
// {
// var cart = new Cart
// {
// GoodsId = battery.Id,
// GoodsCategory = "battery",
// Price = battery.Price,
// Count = 1
// };
// db.Carts.Add(cart);
// }
// else
// {
// tmp.Count++;
// db.Entry(tmp).State = EntityState.Modified;
// }
// db.SaveChanges();
// }
//}
public void AddMonitor(Monitor monitor, List<Cart> list)
{
var cart = new Cart
{
GoodsId = monitor.Id,
GoodsCategory = "Monitors",
Price = monitor.Price,
Count = 1
};
var flg = 1;
foreach (Cart item in list)
{
if (item.GoodsId == monitor.Id && item.GoodsCategory == "Monitors")
{
item.Count++;
flg = 0;
break;
}
}
if (flg == 1)
{
list.Add(cart);
}
}
示例9: ParseContexts
/// <summary>
/// Parses the specified contexts and re-populates context array with features and returns
/// the values for these features.
/// If all values are unspecified, then null is returned.
/// </summary>
/// <param name="contexts">The contexts.</param>
/// <param name="monitor">The evaluation monitor.</param>
/// <returns>The event values.</returns>
/// <exception cref="System.InvalidOperationException">Negative values are not allowed: context</exception>
public static float[] ParseContexts(string[] contexts, Monitor monitor) {
var hasRealValue = false;
var values = new float[contexts.Length];
for (var ci = 0; ci < contexts.Length; ci++) {
var ei = contexts[ci].LastIndexOf("=", StringComparison.InvariantCulture);
if (ei > 0 && ei + 1 < contexts[ci].Length) {
var gotReal = true;
try {
values[ci] = float.Parse(contexts[ci].Substring(ei + 1), CultureInfo.InvariantCulture);
} catch (Exception) {
gotReal = false;
if (monitor != null)
monitor.OnError("Unable to determine value in context:" + contexts[ci]);
values[ci] = 1;
}
if (gotReal) {
if (values[ci] < 0) {
throw new InvalidOperationException("Negative values are not allowed: " + contexts[ci]);
}
contexts[ci] = contexts[ci].Substring(0, ei);
hasRealValue = true;
}
} else {
values[ci] = 1;
}
}
if (!hasRealValue) {
values = null;
}
return values;
}
示例10: SetMonitor
public override void SetMonitor(Monitor mon)
{
foreach (Solver t in solvers)
{
t.SetMonitor(mon);
}
}
示例11: MonitorAdorner
public MonitorAdorner(HeliosVisualView adornedElement, string monitorLabel, Monitor monitor)
: base(adornedElement)
{
_textFormat.VerticalAlignment = TextVerticalAlignment.Center;
_label = monitorLabel;
_monitor = monitor;
}
示例12: HandsRecognition
public HandsRecognition(Monitor mon)
{
m_images = new Queue<PXCMImage>();
this.mon = mon;
LUT = Enumerable.Repeat((byte)0, 256).ToArray();
LUT[255] = 1;
}
示例13: Setup
public void Setup()
{
buildFactoryFake = new BuildFactoryFake();
buildRepositoryFake = new BuildRepositoryFake();
solutionBuildFake = new SolutionBuildFake();
buildFactoryFake.Build = solutionBuildFake;
monitor = new Monitor(buildFactoryFake, buildRepositoryFake);
}
示例14: button4_Click
private void button4_Click(object sender, EventArgs e)
{
var m = new Monitor(true);
m.StandardErrorOut += starter_StandardErrorOut;
m.StandardOut += starter_StandardOut;
m.Start();
}
示例15: StartCommand
public StartCommand(Monitor monitor, Func<Machine> getCurrentMachine, IncludeFileCommand includeCommand) : base(monitor, "start", "starts the emulation.", "s")
{
if(includeCommand == null)
{
throw new ArgumentException("includeCommand cannot be null.", "includeCommand");
}
GetCurrentMachine = getCurrentMachine;
IncludeCommand = includeCommand;
}