コード例 #1
0
        public void CreateEvent(CommandersLogEvent partiallyCompleteCommandersLogEventEvent) // when we create from the webserver
        {
            var now     = DateTime.UtcNow;
            var newGuid = Guid.NewGuid().ToString();

            ClearLogEventFields();
            _callingForm.dtpLogEventDate.Value = now;
            _callingForm.tbLogEventID.Text     = newGuid;
            partiallyCompleteCommandersLogEventEvent.EventID   = Guid.NewGuid().ToString();
            partiallyCompleteCommandersLogEventEvent.EventDate = now;

            LogEvents.Add(partiallyCompleteCommandersLogEventEvent);
        }
コード例 #2
0
        public void CreateEvent(CommandersLogEvent partiallyCompleteCommandersLogEventEvent) // when we create from the webserver
        {
            // set it to UTC everywhere or nowhere -> pay attention to the different timezones
            // if you wan't to concatenate ED-time and local pc time
            //var now =DateTime.UtcNow;
            var now     = DateTime.Now;
            var newGuid = Guid.NewGuid().ToString();

            ClearLogEventFields();
            _callingForm.dtpLogEventDate.Value = now;
            _callingForm.tbLogEventID.Text     = newGuid;
            partiallyCompleteCommandersLogEventEvent.EventID   = Guid.NewGuid().ToString();
            partiallyCompleteCommandersLogEventEvent.EventDate = now;

            LogEvents.Add(partiallyCompleteCommandersLogEventEvent);
        }
コード例 #3
0
        public void CreateEvent(CommandersLogEvent partiallyCompleteCommandersLogEventEvent) // when we create from the webserver
        {
            // set it to UTC everywhere or nowhere -> pay attention to the different timezones
            // if you wan't to concatenate ED-time and local pc time
            //var now =DateTime.UtcNow;
            var now = DateTime.Now;
            var newGuid = Guid.NewGuid().ToString();
            ClearLogEventFields();
            _callingForm.dtpLogEventDate.Value = now;
            _callingForm.tbLogEventID.Text = newGuid;
            partiallyCompleteCommandersLogEventEvent.EventID = Guid.NewGuid().ToString();
            partiallyCompleteCommandersLogEventEvent.EventDate = now;
            
            LogEvents.Add(partiallyCompleteCommandersLogEventEvent);

        }
コード例 #4
0
ファイル: Webserver.cs プロジェクト: nernst/RegulatedNoise
        private void ParseNoteParameters(string requestedUrl)
        {
            var parameterString = requestedUrl.Replace("/createnote.html?", "").Replace("+", " ");
            var x = parameterString.Split('&');

            var newEvent = new CommandersLogEvent();

            foreach (var parameter in x)
            {
                var paramName  = parameter.Split('=')[0];
                var paramValue = parameter.Split('=')[1];

                PropertyInfo prop = newEvent.GetType().GetProperty(paramName, BindingFlags.Public | BindingFlags.Instance);
                if (null != prop && prop.CanWrite)
                {
                    if (prop.PropertyType.UnderlyingSystemType.Name == "Int32")
                    {
                        int intValue;
                        if (int.TryParse(paramValue, out intValue))
                        {
                            prop.SetValue(newEvent, intValue, null);
                        }
                    }
                    else if (prop.PropertyType.UnderlyingSystemType.Name == "Decimal")
                    {
                        decimal intValue;
                        if (decimal.TryParse(paramValue, out intValue))
                        {
                            prop.SetValue(newEvent, intValue, null);
                        }
                    }
                    else
                    {
                        prop.SetValue(newEvent, paramValue, null);
                    }
                }
            }
            _callingForm.GenericSingleParameterMessage(newEvent, AppDelegateType.AddEventToLog);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: GettroLadalle/RegulatedNoise
        /// <summary>
        /// handles mouse clicks on the Commanders Log
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void lvCommandersLog_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            ListView currentListView = ((ListView)sender);

            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                m_RightMouseSelectedLogEvent = null;
                ListViewItem theClickedOne = currentListView.GetItemAt(e.X, e.Y);

                if(theClickedOne != null)
                {
                    var selectedGuid = theClickedOne.SubItems[currentListView.Columns.IndexOfKey("EventID")].Text;
                    m_RightMouseSelectedLogEvent = CommandersLog.LogEvents.Single(x => x.EventID == selectedGuid);

                    contextMenuStrip1.Show(currentListView.PointToScreen(e.Location));
                }

            }
        }
コード例 #6
0
        private void ParseNoteParameters(string requestedUrl)
        {
            var parameterString = requestedUrl.Replace("/createnote.html?","").Replace("+"," ");
            var x = parameterString.Split('&');

            var newEvent = new CommandersLogEvent();

            foreach (var parameter in x)
            {
                var paramName = parameter.Split('=')[0];
                var paramValue = parameter.Split('=')[1];

                PropertyInfo prop = newEvent.GetType().GetProperty(paramName, BindingFlags.Public | BindingFlags.Instance);
                if (null != prop && prop.CanWrite)
                {
                    if (prop.PropertyType.UnderlyingSystemType.Name == "Int32")
                    { 
                        int intValue;
                        if (int.TryParse(paramValue, out intValue))
                         prop.SetValue(newEvent, intValue, null);
                    }
                    else if (prop.PropertyType.UnderlyingSystemType.Name == "Decimal")
                    {
                        decimal intValue;
                        if (decimal.TryParse(paramValue, out intValue))
                            prop.SetValue(newEvent, intValue, null);
                    }
                    else
                        prop.SetValue(newEvent, paramValue, null);
                }

            }
            _callingForm.GenericSingleParameterMessage(newEvent, AppDelegateType.AddEventToLog);
        }