public void DrawBall() { Ball ball = new Ball(); ball.PlaceObject(); McContext.ShowNotification("Use green grip or shake (move) ball to get prediction"); }
// added in v. 1.1 private void OnChanged(object source, FileSystemEventArgs e) { McContext.ShowNotification("File: " + e.FullPath + " " + e.ChangeType); //read new value from file try { if (File.Exists(_monFilePath)) { int mStatus = -1; McContext.ShowNotification("File exists "); using (StreamReader sr = new StreamReader(new FileStream(_monFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) { if (sr.BaseStream.CanRead) { McContext.ShowNotification("can read "); if (int.TryParse(sr.ReadLine(), out mStatus)) { McContext.ShowNotification("parse correct "); if (Enum.IsDefined(typeof(Status), mStatus)) { if (!TryModify()) return; Stat = (Status) mStatus; if (!TryModify()) return; if (!DbEntity.Update()) return; McContext.ShowNotification("Door state is changed"); McContext.ExecuteCommand("REGENALL"); } else McContext.ShowNotification("Incorrect data in the file. Should be in diapason: 0, 1, 2 "); } } else McContext.ShowNotification("Can't read file "); } } else McContext.ShowNotification("File not exists "); _watcher.EnableRaisingEvents = false; // disable tracking } finally { _watcher.EnableRaisingEvents = true; // reconnect tracking } }
public void StartMonitoring() { _watcher = new FileSystemWatcher(); if (File.Exists(_monFilePath)) { _watcher.Path = Path.GetDirectoryName(_monFilePath); _watcher.Filter = Path.GetFileName(_monFilePath); _watchHandler = new FileSystemEventHandler(OnChanged); _watcher.Changed += _watchHandler; _watcher.EnableRaisingEvents = true; } else McContext.ShowNotification("File: " + _monFilePath + " " + "not Exists"); }
public void DrawFace() { //We draw half of face // Draw eye DbCircle eye = new DbCircle(); eye.Radius = 100; eye.Center = new Point3d(200, 500, 0); eye.DbEntity.AddToCurrentDocument(); //Draw nose DbLine nose = new DbLine(); nose.StartPoint = new Point3d(350, 400, 0); nose.EndPoint = new Point3d(350, 200, 0); nose.DbEntity.AddToCurrentDocument(); //Draw mouth DbPolyline mouth = new DbPolyline(); List <Point3d> mouthPoints = new List <Point3d>() { new Point3d(100, 150, 0), new Point3d(200, 100, 0), new Point3d(350, 100, 0) }; mouth.Polyline = new Polyline3d(mouthPoints); mouth.Polyline.SetClosed(false); mouth.DbEntity.Transform(McDocumentsManager.GetActiveDoc().UCS); //change coordinates from UCS to WCS for BD mouth.DbEntity.AddToCurrentDocument(); //draw mirror half the face (2nd half) DbCircle eye2 = new DbCircle(); eye2.Radius = 100; eye2.Center = new Point3d(500, 500, 0); eye2.DbEntity.AddToCurrentDocument(); DbPolyline mouth2 = new DbPolyline(); mouth2.Polyline = mouth.Polyline.Mirror(new Plane3d(new Point3d(350, 100, 0), new Vector3d(200, 0, 0))) as Polyline3d; mouth2.DbEntity.AddToCurrentDocument(); //Get notification in command line McContext.ShowNotification("You need to enter data into the console"); //Get uaser input InputJig editorInput = new InputJig(); string name = editorInput.GetText("Input your name and press Enter"); //Drawing face's text DbText spech = new DbText(); spech.Text = new TextGeom("Oh Master! Why I'm so ugly? Please remove me!", new Point3d(510, 15, 0), Vector3d.XAxis, "Standard", 15); spech.DbEntity.AddToCurrentDocument(); //Get windows message box MessageBox.Show("Congratulation " + name + " you did it! But look, it want, to say something to you..."); //Get popup help McContext.PopupNotification("Delete command has activated"); //Activate another command (Delete) McContext.ExecuteCommand("Delete"); }