public static void Main(string[] args) { Console.WriteLine ("MyATM Server - Signed off by Andrew As Active Object - Signed off as Application."); int test = 0; bool debug = false; //To allow Prompts on the Server set this to true try { Console.WriteLine("\n\nInput: MyATM Server\n 0 - DEBUG = TRUE \t|\n 1 - DEBUG = FALSE \t|\n"); test = int.Parse(Console.ReadLine()); if(test == 0) { debug = true; Console.WriteLine("Debug is set to true - You will see the Server program checking items"); } else if(test == 1) { debug = false; Console.WriteLine("Debug is set to False - You will NOT see the Server program checking items"); } else { Console.WriteLine("Exiting Program"); Thread.Sleep(5000); System.Environment.Exit(1); } Console.WriteLine("\n\n"); } catch (Exception) { Console.WriteLine("Unknown Input - Exiting in 5s"); Thread.Sleep(5000); System.Environment.Exit(1); } //Input to allow Connection Over Putty ArrayList m_workerSocketList = ArrayList.Synchronized(new ArrayList()); List<Account> Accounts = new List<Account>(); char[] delimiterChars = { ',', '.' }; int m_clientCount = 0; Socket m_mainSocket = null; AsyncCallback pfnWorkerCallBack = null; //End Connection Variables //Channels Used Channel<String> CapInToProcingMess = new Channel<String> (); Channel<String> OutputToClient = new Channel<String>(); //End Channel Used //Reader Writer for account Editing ReaderWriter AccountManager = new ReaderWriter(); //Active Objects Used ProcessMessage Logic = new ProcessMessage(CapInToProcingMess, OutputToClient,Accounts, delimiterChars, debug,AccountManager); ClientListener WaitingForClient = new ClientListener(CapInToProcingMess, m_workerSocketList, m_clientCount, m_mainSocket, pfnWorkerCallBack); OutputMessage Feedback = new OutputMessage(OutputToClient, m_workerSocketList, delimiterChars); //Start Active Objects WaitingForClient.Start (); Logic.Start (); Feedback.Start (); }
public Host() { InitializeComponent(); m_Log = log4net.LogManager.GetLogger("Kaitrade"); m_SubscribeMD = new RegisterSubject(this.doSubscribeMD); m_RegisterTS = new RequestTS(this.doRequestTS); m_ProcessMessage = new ProcessMessage(this.doProcessMessage); m_Connect = new Connect(this.doConnect); //timer1.Interval = 0; //timer1.Start(); }
public CQGFrm() { try { InitializeComponent(); m_Log = log4net.LogManager.GetLogger("Kaitrade"); //m_RegisterSubject = new RegisterSubject(this.doRegisterSubject); m_ProcessMessage = new ProcessMessage(this.doProcessMessage); // Start connection to CQG m_CQG = null; //m_CQG = new CQGCEL(); } catch (Exception myE) { } }
private async Task EnqueueMessageForAccountingDocumentCreation(long transactionDocumentId, string company) { var authorizationResult = await _authorizationService.AuthorizeAsync(_identityService.GetUser(), Policies.PostOpClosedPolicy); var content = new JObject(); content.Add(new JProperty("docId", transactionDocumentId)); content.Add(new JProperty("postOpClosedPolicy", authorizationResult.Succeeded)); ProcessMessage message = new ProcessMessage { ProcessTypeId = (int)ProcessType.AtlasAccountingDocumentProcessor, CompanyId = company, Content = content.ToString(), }; await _processMessageService.SendMessage(message); }
public bool Delete(Subsystem entity) { Guard.Against <ArgumentNullException>(entity == null, nameof(entity)); try { // ReSharper disable once AssignNullToNotNullAttribute DataContext.Subsystems.Remove(entity); DataContext.Save(); return(true); } catch (Exception ex) { ProcessMessage.WrapException(ex); return(false); } }
public Author Add(Author entity) { Guard.Against <ArgumentNullException>(entity == null, nameof(entity)); try { // ReSharper disable once AssignNullToNotNullAttribute _dataContext.Authors.Add(entity); Flush(); return(entity); } catch (DataSourceException ex) { ProcessMessage.WrapException(ex); return(null); } }
protected void SendLocalAsyncMessage(ProcessMessage pm) { System.Threading.Tasks.Task.Factory.StartNew((q) => { ProcessMessage m = q as ProcessMessage; try { log.Warn("Handling async message {0} from {1}", m.GetType().Name, m.FromTaskInstanceId); HandleLocalAsyncMessage(pm); } catch (Exception ex) { //TODO: some error handling here, for example report 'TaskFailed' for EnableTask log.Error("Error handling local async message {0} from {1}: {2}", m.GetType().Name, m.FromTaskInstanceId); } }, pm); }
public NoteCatalog Add(NoteCatalog entity) { Guard.Against <ArgumentNullException>(entity == null, nameof(entity)); try { // ReSharper disable once AssignNullToNotNullAttribute DataContext.Catalogs.Add(entity); DataContext.Save(); return(entity); } catch (Exception ex) { ProcessMessage.WrapException(ex); return(null); } }
public StickyWindow(Form form) { this.originalForm = form; this.formRect = Rectangle.Empty; this.formOffsetRect = Rectangle.Empty; this.formOffsetPoint = Point.Empty; this.offsetPoint = Point.Empty; this.mousePoint = Point.Empty; this.stickOnMove = true; this.stickOnResize = true; this.stickToScreen = true; this.stickToOther = true; this.DefaultMessageProcessor = new ProcessMessage(this.DefaultMsgProcessor); this.MoveMessageProcessor = new ProcessMessage(this.MoveMsgProcessor); this.ResizeMessageProcessor = new ProcessMessage(this.ResizeMsgProcessor); this.MessageProcessor = this.DefaultMessageProcessor; base.AssignHandle(this.originalForm.Handle); }
/// <summary> /// /// <summary> /// EasyNetQ封装方法 /// </summary> /// </summary> public static void EasyNetQConsumer() { try { ProcessMessage order = new ProcessMessage(); Message msg = new Message(); msg.MessageID = "1"; msg.MessageRouter = "llj"; MQHelper.Subscribe(msg, order); } catch (EasyNetQException ex) { //处理连接消息服务器异常 // MessageHelper.WriteFuntionExceptionLog("Publish", ex.Message + " | " + ex.StackTrace); } }
protected void SendProcessMessage(ProcessMessage pm, bool separateTransaction) { if (separateTransaction) { if (IsPersistent) { _runner.MessageBus.Notify(pm); } else { _asyncQueue.Enqueue(pm); } } else { _syncQueue.Enqueue(pm); } }
public async Task <bool> DeleteAsync(NoteRender entity) { Guard.Against <ArgumentNullException>(entity == null, nameof(entity)); try { // ReSharper disable once AssignNullToNotNullAttribute DataContext.Renders.Remove(entity); await DataContext.SaveAsync(); return(true); } catch (Exception ex) { ProcessMessage.WrapException(ex); return(false); } }
public IActionResult Post([FromBody] OrderDetails details) { Dictionary <string, string> response = new Dictionary <string, string>(); try { if (details != null) { string orderData = JsonConvert.SerializeObject(details); ProcessMessage _payment = new ProcessMessage(_config); string result = string.Empty; int responseCode = _payment.ProcessMessageMethod(details, ref result); switch (responseCode) { case 202: return(Accepted(result)); case 400: return(BadRequest(result)); } return(Ok()); } else { response["message"] = "Body should not be empty"; response["code"] = "400"; return(BadRequest(response)); } } catch (JsonSerializationException ex) { response["message"] = "Invalid Data Format " + ex.Message; response["code"] = "400"; return(BadRequest(response)); } catch (Exception ex) { response["message"] = "(500) internal server error " + ex.Message; response["code"] = "500"; return(StatusCode(StatusCodes.Status500InternalServerError, response)); } }
public void ReturnMessage(string Message, string ExecutionsId, int Status, int ProcessId) { //檢查應關但未關程式 //你應該被關掉啦!? //還傳東西給我幹嘛(((゚Д゚;))) SetExecutions.ShouldKillProcess(ExecutionsId, ProcessId); //如果要秀東西 if (true) { var context = GlobalHost.ConnectionManager.GetHubContext <myhub>(); ProcessMessage ProcessMessage = new ProcessMessage { ExecutionsId = ExecutionsId, Message = Message }; context.Clients.All.Message(ProcessMessage); } }
private bool StartResize(ResizeDir resDir) { if (StickOnResize) { _resizeDirection = resDir; _formRect = _originalFormAdapter.Bounds; _formOriginalRect = _originalFormAdapter.Bounds; // save the old bounds if (!_originalFormAdapter.Capture) // start capturing messages { _originalFormAdapter.Capture = true; } _messageProcessor = _resizeMessageProcessor; return(true); // catch the message } return(false); // leave default processing ! }
public void ProcessMessageQueue(ProcessMessage processMessage) { if (!Connected) { return; } if (msgQueue.Out.Count == 0) { // wold block for aaccquiring lock msgQueue.Swap(); } while (msgQueue.Out.Count > 0) { var msg = msgQueue.Out.Dequeue(); processMessage(this, msg); } }
/// <summary> /// CheckProcessStatus will return true if the supplied process id is still running /// </summary> public bool CheckProcessStatus(int target) { var running = false; // create message object, serialize and send to server var pStatus = new ProcessMessage { ProcId = target, MessageType = 3 }; // var byteArray = JsonSerializer.Serialize(pStatus); var byteArray = JsonConvert.SerializeObject(pStatus); // pass byteArray to TCP server and parse response. A response of "1" means the process is running. var response = Connect(byteArray); if (response == "1") { running = true; } return(running); }
/// <summary> /// ProcessRunning is to be used as a conditional check to determine if the process should continue running or not. /// It will return true when there is not kill request for the process, and false when there is. /// It can be used to terminate or break out of long, nested, or indefinite running loops. /// </summary> public bool ProcessRunning() { var keepRunning = true; // create message object, serialize and send to server var pStatus = new ProcessMessage { ProcId = _procId, MessageType = 1 }; // var byteArray = JsonSerializer.Serialize(pStatus); var byteArray = JsonConvert.SerializeObject(pStatus); // pass object and read response var response = Connect(byteArray); // if response = 0, that means there has been a kill request. return false to the application so it knows to stop running. if (response == "0") { keepRunning = false; } return(keepRunning); }
private bool StartResize(ResizeDir resDir) { if (stickOnResize) { resizeDirection = resDir; formRect = originalForm.Bounds; formOriginalRect = originalForm.Bounds; // save the old bounds if (!originalForm.Capture) // start capturing messages { originalForm.Capture = true; } MessageProcessor = ResizeMessageProcessor; return(true); // catch the message } else { return(false); // leave default processing ! } }
public void PostStatus(string message, string location) { this.Init(); var statusId = SequentialGuid.Create(); Status status = new Status { StatusId = statusId, UserId = this._curUserChat.UserId }; this._statusRepository.AddStatus(status); this._statusMessageRepository.AddMessage(new StatusMessage { StatusId = statusId, Message = message }); if (!string.IsNullOrEmpty(location)) { this._statusLocationRepository.AddLocation(statusId, location); } var newFeedId = SequentialGuid.Create(); NewFeeds newfeed = new NewFeeds { UserId = this._curUserChat.UserId, NewFeedId = newFeedId, TypeActionId = TypeAction.POST_STATUS, StatusId_Or_UserId = statusId }; this._newFeedRepository.AddNewFeed(newfeed); message = ProcessMessage.ProcessMessageStatus(statusId, this._curUserChat, message, null); Clients.Clients(this._allUserRelate_ConnectionId).postCastStatus(this._curUserChat.Displayname, message); Clients.Clients(this._friendListConnectionId_Online).statusNewFeeds(this._curUserChat); }
public void PostImage(string message, string[] imageNames) { this.Init(); var statusId = SequentialGuid.Create(); Status status = new Status { StatusId = statusId, UserId = this._curUserChat.UserId }; this._statusRepository.AddStatus(status); this._statusMessageRepository.AddMessage(new StatusMessage { StatusId = statusId, Message = message }); message = ProcessMessage.ProcessMessageStatus(statusId, this._curUserChat, message, imageNames); this._statusImageRepository.AddRangeImage(statusId, imageNames); Clients.Clients(this._allUserRelate_ConnectionId).postImage(this._curUserChat.Displayname, message); }
public ProcessMessage GenerateDnPdf(string template, string dataJson, string dnKey) { ProcessMessage msg = new ProcessMessage() { Result = false }; try { Console.WriteLine("*******"); Console.WriteLine(template); Console.WriteLine(dnKey); Console.WriteLine("*******"); string fileName = Guid.NewGuid().ToString() + ".pdf"; string folderPath = ConfigReader.DnPdfOutPutPath; IGenPrinter dnPdfPrinter = new GenPrinterBase(folderPath, template); dnPdfPrinter.Print(JSON.parse<RecordSet>(dataJson), fileName); AliOssHelper.UploadFile(ConfigReader.DnBucketName, fileName, dnPdfPrinter.GetFilePath(), "application/pdf"); msg.Result = true; msg.Content = fileName; } catch (Exception e) { msg.Content = e.Message; } return msg; }
public async Task <IHttpActionResult> PostProcessMessage([FromBody] ProcessMessage processMessage) { if (!ModelState.IsValid) { ModelState.AddModelError("Message", "The process message details are not valid!"); return(BadRequest(ModelState)); } try { db.ProcessMessages.Add(processMessage); await db.SaveChangesAsync(); ProcessMessage lastpc = await db.ProcessMessages.OrderByDescending(pc => pc.messageId).FirstAsync(); return(Ok <ProcessMessage>(lastpc));; } catch (Exception) { ModelState.AddModelError("Message", "Error during saving your process message!"); return(BadRequest(ModelState)); } }
/// <summary> /// Initializes a new instance of the <see cref="NuGenUISnap"/> class. /// </summary> /// <exception cref="ArgumentNullException"> /// <para><paramref name="stickyForm"/> is <see langword="null"/>.</para> /// -or- /// <para><paramref name="owner"/> is <see langword="null"/>.</para> /// </exception> public WndManager(Form stickyForm, NuGenUISnap owner) { if (stickyForm == null) { throw new ArgumentNullException("stickyForm"); } if (owner == null) { throw new ArgumentNullException("owner"); } _resizingForm = false; _movingForm = false; _originalForm = stickyForm; _owner = owner; _formBounds = Rectangle.Empty; _formOffsetRect = Rectangle.Empty; _formOffsetPoint = Point.Empty; _primaryOffset = Point.Empty; _mousePosition = Point.Empty; _defaultMessageProcessor = new ProcessMessage(DefaultMsgProcessor); _moveMessageProcessor = new ProcessMessage(MoveMsgProcessor); _resizeMessageProcessor = new ProcessMessage(ResizeMsgProcessor); _messageProcessor = _defaultMessageProcessor; AssignHandle(_originalForm.Handle); _originalForm.HandleCreated += delegate { AssignHandle(_originalForm.Handle); }; }
public async Task <IHttpActionResult> PutProcessMessage(int messageId, ProcessMessage processMessage) { if (!ModelState.IsValid) { ModelState.AddModelError("Message", "The process message details are not valid!"); return(BadRequest(ModelState)); } if (messageId != processMessage.messageId) { ModelState.AddModelError("Message", "The process message id is not valid!"); return(BadRequest(ModelState)); } db.Entry(processMessage).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProcessMessageExists(messageId)) { ModelState.AddModelError("Message", "Process message not found!"); return(BadRequest(ModelState)); } else { throw; } } ProcessMessage pm = await db.ProcessMessages.Where(pmt => pmt.messageId == messageId).FirstAsync(); return(Ok <ProcessMessage>(pm)); }
public async Task <HmmNote> AddAsync(HmmNote entity) { Guard.Against <ArgumentNullException>(entity == null, nameof(entity)); try { // check if need apply default catalog // ReSharper disable once PossibleNullReferenceException var catalog = PropertyChecking(entity.Catalog); entity.Catalog = catalog ?? throw new Exception("Cannot find default note catalog."); entity.CreateDate = DateTimeProvider.UtcNow; entity.LastModifiedDate = DateTimeProvider.UtcNow; var savedAuthor = await DataContext.Authors.FindAsync(entity.Author.Id); if (savedAuthor != null) { entity.Author = savedAuthor; } var savedCat = await DataContext.Catalogs.FindAsync(entity.Catalog.Id); if (savedCat != null) { entity.Catalog = savedCat; } DataContext.Notes.Add(entity); await DataContext.SaveAsync(); return(entity); } catch (Exception ex) { ProcessMessage.WrapException(ex); return(null); } }
public HmmNote Update(HmmNote entity) { Guard.Against <ArgumentNullException>(entity == null, nameof(entity)); try { // check if need apply default catalog // ReSharper disable once PossibleNullReferenceException var catalog = PropertyChecking(entity.Catalog); entity.Catalog = catalog ?? throw new Exception("Cannot find default note catalog."); entity.LastModifiedDate = DateTimeProvider.UtcNow; DataContext.Notes.Update(entity); DataContext.Save(); var savedRec = LookupRepo.GetEntity <HmmNote>(entity.Id); return(savedRec); } catch (Exception ex) { ProcessMessage.WrapException(ex); return(null); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { string queueName = ConfigurationManager.AppSettings["MSMQLocation"]; MessageQueue rmTxnQ = new MessageQueue(queueName); rmTxnQ.Formatter = new XmlMessageFormatter(new Type[] { typeof(ProcessMessage) }); foreach (ListBoxItem itm in files.Items) { MessageQueueTransaction msgTx = new MessageQueueTransaction(); msgTx.Begin(); try { string argument = "-i \"{0}\" -o \"{1}\" --preset \"" + ConfigurationManager.AppSettings["HandbrakePreset"] + "\""; string destination = txtDestination.Text + "\\" + System.IO.Path.GetFileNameWithoutExtension(itm.ToolTip.ToString()) + ".m4v"; ProcessMessage p = new ProcessMessage() { CommandLine = argument, DestinationURL = destination, OrignalFileURL = itm.ToolTip.ToString() }; rmTxnQ.Send(p, msgTx); results.Items.Insert(0, string.Format("{0} added to queue", p.OrignalFileURL)); msgTx.Commit(); } catch (Exception ex) { results.Items.Insert(0, ex.Message); msgTx.Abort(); } } }
private void StartMove() { formRect = originalForm.Bounds; formOriginalRect = originalForm.Bounds; // save original position if (!originalForm.Capture) // start capturing messages originalForm.Capture = true; MessageProcessor = MoveMessageProcessor; }
private void StartMove() { _formRect = _originalForm.Bounds; _formOriginalRect = _originalForm.Bounds; // save original position if (!_originalForm.Capture) // start capturing messages _originalForm.Capture = true; _messageProcessor = _moveMessageProcessor; }
public void MessageParse(string message) { string[] temp = message.Split('#'); if (temp[0] == "list") { if (this.SeedersList.InvokeRequired) { ProcessMessage p = new ProcessMessage(MessageParse); this.Invoke(p, new object[] { message }); } else { SeedersList.Items.Clear(); } for (int i = 1; i < temp.Length; i++) { if (this.SeedersList.InvokeRequired) { ProcessMessage p = new ProcessMessage(MessageParse); this.Invoke(p, new object[] { message }); } else { if (!SeedersList.Items.Contains(temp[i])) { SeedersList.Items.Add(temp[i]); } } } } else if (temp[0] == "info") { if (this.SeederData.InvokeRequired) { ProcessMessage p = new ProcessMessage(MessageParse); this.Invoke(p, new object[] { message }); } else { SeederData.Text = temp[1]; } } else if (temp[0] == "") { if (this.ErrorBox.InvokeRequired) { ProcessMessage p = new ProcessMessage(MessageParse); this.Invoke(p, new object[] { message }); } else { ErrorBox.Text = "Lost connection."; } } else { if (this.ErrorBox.InvokeRequired) { ProcessMessage p = new ProcessMessage(MessageParse); this.Invoke(p, new object[] { message }); } else { ErrorBox.Text = (temp[0]); } } }
/// <summary> /// Make the form Sticky /// </summary> /// <param name="form">Form to be made sticky</param> public NuGenUISnap(Form form) { resizingForm = false; movingForm = false; originalForm = form; formRect = Rectangle.Empty; formOffsetRect = Rectangle.Empty; formOffsetPoint = Point.Empty; offsetPoint = Point.Empty; mousePoint = Point.Empty; stickOnMove = true; stickOnResize = true; stickToScreen = true; stickToOther = true; DefaultMessageProcessor = new ProcessMessage ( DefaultMsgProcessor ); MoveMessageProcessor = new ProcessMessage ( MoveMsgProcessor ); ResizeMessageProcessor = new ProcessMessage ( ResizeMsgProcessor ); MessageProcessor = DefaultMessageProcessor; AssignHandle ( originalForm.Handle ); }
public Discovery(IPAddress local, ProcessMessage processMessageMethod) : this(local) { _processMessageMethod = processMessageMethod; }
private void PopulateJudgeList(SimhoppMessage msg) { try { ProcessMessage d = new ProcessMessage(_view.PopulateJudgeList); _view.Invoke(d, msg); } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
private void LogMessage(SimhoppMessage msg) { return; try { ProcessMessage d = new ProcessMessage(_view.LogMessage); _view.Invoke(d, msg); } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
/// <summary> /// Called when Excel requests the first RTD topic for the server. /// Connect to the broker, returns a on success and 0 otherwise /// </summary> /// <param name="CallbackObject"></param> /// <returns></returns> public int ServerStart(IRTDUpdateEvent CallbackObject) { _onMessage = CallbackObject; string host = "localhost"; string port = "5673"; string virtualhost = "test"; string username = "******"; string password = "******"; _messageProcessor = getMessage; if( ConfigurationManager.AppSettings["Host"] != null ) { host = ConfigurationManager.AppSettings["Host"]; } if (ConfigurationManager.AppSettings["Port"] != null) { port = ConfigurationManager.AppSettings["Port"]; } if (ConfigurationManager.AppSettings["VirtualHost"] != null) { virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; } if (ConfigurationManager.AppSettings["Username"] != null) { username = ConfigurationManager.AppSettings["UserName"]; } if (ConfigurationManager.AppSettings["Password"] != null) { password = ConfigurationManager.AppSettings["Password"]; } if (ConfigurationManager.AppSettings["ProcessorAssembly"] != null) { try { Assembly a = Assembly.LoadFrom(ConfigurationManager.AppSettings["ProcessorAssembly"]); Object o = a.CreateInstance(ConfigurationManager.AppSettings["ProcessorClass"]); MessageProcessor p = (MessageProcessor) o; _messageProcessor = p.ProcessMessage; } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace); return 0; } } System.Windows.Forms.MessageBox.Show("Connection parameters: \n host: " + host + "\n port: " + port + "\n user: "******"Error: \n" + e.StackTrace); return 0; } // always successful return 1; }
/// <summary> /// Make the form Sticky /// </summary> /// <param name="form">Form to be made sticky</param> public StickyWindow(Form form) { _resizingForm = false; _movingForm = false; _originalForm = form; _formRect = Rectangle.Empty; _formOffsetRect = Rectangle.Empty; _formOffsetPoint = Point.Empty; _offsetPoint = Point.Empty; _mousePoint = Point.Empty; StickOnMove = true; StickOnResize = true; StickToScreen = true; StickToOther = true; _defaultMessageProcessor = DefaultMsgProcessor; _moveMessageProcessor = MoveMsgProcessor; _resizeMessageProcessor = ResizeMsgProcessor; _messageProcessor = _defaultMessageProcessor; AssignHandle(_originalForm.Handle); }
public WebSocketServer(ProcessMessage pm) { _processMessage = pm; ServerPort = 4141; ServerLocation = string.Format("ws://{0}:4141/chat", GetLocalmachineIPAddress()); Initialize(); }
public void ProcessMessageQueue(ProcessMessage processMessage) { if (!Connected) { return; } if (msgQueue.Out.Count == 0) { // wold block for aaccquiring lock msgQueue.Swap(); } while (msgQueue.Out.Count > 0) { var msg = msgQueue.Out.Dequeue(); processMessage(this, msg); } }
protected internal virtual void OnProcessMessage(NotificationMessage message) => ProcessMessage?.Invoke(this, new NotifMessageEventArgs(message));
private void Process_RedirectOutputEvent(ProcessMessage processMessage) { print(processMessage.Arguments); }
/// <summary> /// Initializes a new instance of the <see cref="NuGenUISnap"/> class. /// </summary> /// <exception cref="ArgumentNullException"> /// <para><paramref name="stickyForm"/> is <see langword="null"/>.</para> /// -or- /// <para><paramref name="owner"/> is <see langword="null"/>.</para> /// </exception> public WndManager(Form stickyForm, NuGenUISnap owner) { if (stickyForm == null) { throw new ArgumentNullException("stickyForm"); } if (owner == null) { throw new ArgumentNullException("owner"); } _resizingForm = false; _movingForm = false; _originalForm = stickyForm; _owner = owner; _formBounds = Rectangle.Empty; _formOffsetRect = Rectangle.Empty; _formOffsetPoint = Point.Empty; _primaryOffset = Point.Empty; _mousePosition = Point.Empty; _defaultMessageProcessor = new ProcessMessage(DefaultMsgProcessor); _moveMessageProcessor = new ProcessMessage(MoveMsgProcessor); _resizeMessageProcessor = new ProcessMessage(ResizeMsgProcessor); _messageProcessor = _defaultMessageProcessor; AssignHandle(_originalForm.Handle); _originalForm.HandleCreated += delegate { AssignHandle(_originalForm.Handle); }; }
private void CQGFrm_FormClosed(object sender, FormClosedEventArgs e) { try { m_Log.Info("CQGFrm_FormClosed"); m_Adapter = null; m_CQG = null; m_ProcessMessage = null; m_RegisterSubject = null; } catch (Exception myE) { } }
private void NotAccepted(SimhoppMessage msg) { try { ProcessMessage d = new ProcessMessage(_view.NotAccepted); _view.Invoke(d, msg); } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
private void TDAHost_FormClosed(object sender, FormClosedEventArgs e) { m_ProcessMessage = null; m_SubscribeMD = null; m_Adapter = null; }
private void AssignLogin(SimhoppMessage msg) { try { ProcessMessage d = new ProcessMessage(_view.AssignLogin); _view.Invoke(d, msg); } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
public void addMessageListener(ProcessMessage processMessage) { messageHandler = processMessage; }
protected void HandleLocalAsyncMessage(ProcessMessage pm) { }
private void Cancel() { originalForm.Capture = false; movingForm = false; resizingForm = false; MessageProcessor = DefaultMessageProcessor; }
public string GetLinesProcessData(ProcessMessage process, int shootNumber) { return("{" + string.Format("x: {0}, y: {1} ", shootNumber.ToString(), Convert.ToInt32(process.ProcessingTime.TotalMilliseconds).ToString()) + "}"); }
/// <summary> /// Make the form Sticky /// </summary> /// <param name="form">Form to be made sticky</param> public StickyWindow(IFormAdapter form) { resizingForm = false; movingForm = false; originalForm = form; form.StickyWindow = this; formRect = Rectangle.Empty; formOffsetRect = Rectangle.Empty; formOffsetPoint = Point.Empty; offsetPoint = Point.Empty; mousePoint = Point.Empty; stickOnMove = true; stickOnResize = true; stickToScreen = true; stickToOther = true; moveStuck = true; DefaultMessageProcessor = new ProcessMessage(DefaultMsgProcessor); MoveMessageProcessor = new ProcessMessage(MoveMsgProcessor); ResizeMessageProcessor = new ProcessMessage(ResizeMsgProcessor); MessageProcessor = DefaultMessageProcessor; AssignHandle(originalForm.Handle); }
private bool StartResize(ResizeDir resDir) { if (stickOnResize) { resizeDirection = resDir; formRect = originalForm.Bounds; formOriginalRect = originalForm.Bounds; // save the old bounds if (!originalForm.Capture) // start capturing messages originalForm.Capture = true; MessageProcessor = ResizeMessageProcessor; return true; // catch the message } else return false; // leave default processing ! }
private void Cancel() { _originalForm.Capture = false; _movingForm = false; _resizingForm = false; _messageProcessor = _defaultMessageProcessor; }