Ejemplo n.º 1
0
        static public Snapshot.SnapshotList LoadSnapshots(string serverInstance)
        {
            // Create return snapshot list.
            Snapshot.SnapshotList snapshotList = new SnapshotList();

            // Retrieve snapshot information for a server.
            try
            {
                using (SqlConnection connection = new SqlConnection(Program.gController.Repository.ConnectionString))
                {
                    connection.Open();
                    using (SqlDataReader rdr = Sql.SqlHelper.ExecuteReader(connection, null, CommandType.Text,
                                                                           string.Format(QueryGetSnapshotList, serverInstance), null))
                    {
                        while (rdr.Read())
                        {
                            Snapshot snap = new Snapshot(rdr);

                            snapshotList.Add(snap);
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                logX.loggerX.Error(@"Error - Unable to get snapshot list", ex);
                MsgBox.ShowError(ErrorMsgs.CantGetSnapshots, ex);
            }

            return(snapshotList);
        }
Ejemplo n.º 2
0
        public void Add(DataNode item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (item.Parent != null)
            {
                throw new ArgumentException("The item is already assigned to another DataNode.");
            }

            item.Parent = _parent;

            _nodes.Add(item);
            _changeCount++;
        }
Ejemplo n.º 3
0
        private void FireEventToRule_Click(object sender, EventArgs e)
        {
            if (_item == null)
            {
                MessageBox.Show("Please select an Item first...");
                return;
            }

            EventSource eventSource = new EventSource()
            {
                FQID = _item.FQID,
                Name = _item.Name
            };
            EventHeader eventHeader = new EventHeader()
            {
                ID        = Guid.NewGuid(),
                Class     = "NewEventToRule",
                Type      = _textBoxEventType.Text,
                Timestamp = DateTime.Now,
                Message   = _textBoxMessage.Text,
                Name      = _textBoxEventName.Text,
                Source    = eventSource
            };
            // In this sample the snap shots are being saved. This will make the
            // the build-in AlarmPreview in Smart Client display them in the case where the event result in an alarm.
            SnapshotList snapshots = new SnapshotList();

            for (int ix = 0; ix < _imageList.Count; ix++)
            {
                snapshots.Add(new Snapshot()
                {
                    Image = convertImage(_imageList[ix])
                });
            }

            AnalyticsEvent analyticsEvent = new AnalyticsEvent()
            {
                EventHeader  = eventHeader,
                SnapshotList = snapshots
            };

            EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.NewEventCommand)
            {
                Data = analyticsEvent
            });
        }