Example #1
0
 /// <summary>
 /// Initializes object instance
 /// </summary>
 /// <param name="client">client to perform attach</param>
 /// <param name="verbosity">new delay mode</param>
 public SetDelayModeAction(LogClient client, bool delayMode)
 {
     if (client == null)
         throw new ArgumentNullException("client");
     _client = client;
     _delayMode = delayMode;
 }
Example #2
0
 /// <summary>
 /// Initializes object instance
 /// </summary>
 /// <param name="logClient">assigned logClient object</param>
 public NetLogClientView(LogClient logClient)
     : base()
 {
     if (logClient == null)
         throw new ArgumentNullException("logClient");
     _logClient = logClient;
     InitializeComponent();
     statusStrip.Items.Add("Unknown client state");
     logClient.InnerObj.OnStateChanged += new NetLogViewerLib._INetLogClientEvents_OnStateChangedEventHandler(InnerObj_OnStateChanged);
     logClient.InnerObj.OnLogMessage += new NetLogViewerLib._INetLogClientEvents_OnLogMessageEventHandler(InnerObj_OnLogMessage);
 }
Example #3
0
 /// <summary>
 /// Initializes object instance
 /// </summary>
 /// <param name="client">client to perform attach</param>
 /// <param name="DataSet">DataSet, containing messages</param>
 public SaveMessagesAction(LogClient client, DataSet dataSet)
 {
     if (client == null)
         throw new ArgumentNullException("client");
     if (dataSet == null)
         throw new ArgumentNullException("dataSet");
     if (dataSet.Tables.Count <= 0)
         throw new Exception("Dataset should contan at least one table");
     _client = client;
     _dataSet = dataSet;
 }
 /// <summary>
 /// Initializes object instance
 /// </summary>
 /// <param name="client">client to perform attach</param>
 public Attach2ClientAction(LogClient client)
 {
     if (client == null)
         throw new ArgumentNullException("client");
     _client = client;
 }
Example #5
0
 /// <summary>
 /// IAction Execute implementation
 /// </summary>
 public void Execute()
 {
     try
     {
         if (Active)
         {
             OpenFileDialog openDialog = new OpenFileDialog();
             openDialog.CheckFileExists = true;
             openDialog.Filter = "Log files (*.xml,*.log)|*.xml;*.log|All files|*";
             openDialog.DefaultExt = "xml";
             openDialog.Multiselect = false;
             if (openDialog.ShowDialog() != DialogResult.OK)
                 return;
             string fileName = openDialog.FileName;
             int slashPos = System.Math.Max(fileName.LastIndexOf('\\'), fileName.LastIndexOf('/'));
             string shortName = null;
             if (slashPos >= 0)
                 shortName = fileName.Remove(0, slashPos + 1);
             else
                 shortName = fileName;
             LogClient client = new LogClient(new CNetLogClientClass());
             client.InnerObj.Name = shortName;
             NetLogClientView clientView = new NetLogClientView(client);
             TabPage tabPage = TabObjectsCollection.Instance.FindObject(client);
             if (tabPage != null)
             {
                 new CloseClientTabAction(client).Execute();
             }
             // Adding new tab page
             tabPage = TabObjectsCollection.Instance.AddObject(client);
             clientView.Parent = tabPage;
             clientView.Dock = DockStyle.Fill;
             if (fileName.ToLower().EndsWith(".xml"))
                 clientView.messagesDataSet.ReadXml(fileName);
             else
             {
                 bool visible = false;
                 if (null != _progressBar)
                 {
                     visible = _progressBar.Visible;
                     _progressBar.Visible = true;
                     _progressBar.Value = 0;
                 }
                 try
                 {
                     new Log2DataSet(fileName, clientView.messagesDataSet, _progressBar).Parse();
                 }
                 finally
                 {
                     if (null != _progressBar)
                     {
                         _progressBar.Visible = visible;
                     }
                 }
             }
             TabObjectsCollection.Instance.SelectObject(client);
         }
     }
     catch (COMException exception)
     {
         MessageBox.Show(exception.ToString(), "Failed Load log messages");
     }
     catch (Exception exception)
     {
         MessageBox.Show(String.Format("File cannot be opened due to format incompatibility\n{0}\n{1}",exception.Message,exception.StackTrace), "Wrong file format", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch
     {
         MessageBox.Show("File cannot be opened due to format incompatibility", "Wrong file format", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }