Ejemplo n.º 1
0
        private void AddNewQueryTab()
        {
            using (NewConnection nc = new NewConnection())
            {
                if (nc.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                string msg = null;

                try
                {
                    ConnectionInfo info = nc.ConnectionInfo;
                    info.NotificationSubscriber = this;
                    info.Connect();

                    CreateQueryTab(info.Title, info);
                    objectExplorer.AddServer(new SwisMetaDataProvider(info), info);
                }
                catch (FaultException <InfoServiceFaultContract> ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Detail.Message;
                }
                catch (SecurityNegotiationException ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Message;
                }
                catch (FaultException ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                }
                catch (MessageSecurityException ex)
                {
                    log.Error("Failed to connect", ex);
                    if (ex.InnerException != null && ex.InnerException is FaultException)
                    {
                        msg = (ex.InnerException as FaultException).Message;
                    }
                    else
                    {
                        msg = ex.Message;
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Message;
                }

                if (msg != null)
                {
                    msg = string.Format("Unable to connect to Information Service. {0}", msg);
                    MessageBox.Show(this, msg, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
        internal static ConnectionInfo AskForNewConnection()
        {
            using (var nc = new NewConnection())
            {
                if (nc.ShowDialog() == DialogResult.OK)
                {
                    return(nc.ConnectionInfo);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        public void RunPlayback()
        {
            try
            {
                ShowTabs(Tabs.Log);
                var openFileDialog1 = new OpenFileDialog
                {
                    InitialDirectory = "c:\\",
                    Filter           = "log files (*.log)|*.log|All files (*.*)|*.*",
                    DefaultExt       = "log",
                    FilterIndex      = 2,
                    RestoreDirectory = true
                };


                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    var pbi = new PlaybackItem()
                    {
                        FileName = openFileDialog1.FileName, MultiThread = false, QueryTab = this
                    };
                    using (var nc = new NewConnection())
                    {
                        if (nc.ShowDialog(this) != DialogResult.OK)
                        {
                            return;
                        }

                        var info = nc.ConnectionInfo;
                        info.Connect();
                        pbi.ConnectionInfo = info;
                        PlaybackManager.StartPlayback(pbi);
                    }
                    logTextbox.Text = "Started Playback...\r\n";
                }
            }
            catch (Exception ex)
            {
                AppendLogTabLine("Error starting playback.\r\n");
                AppendLogTabLine(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        internal static ConnectionInfo AskForNewConnection()
        {
            using (var nc = new NewConnection())
            {
                if (nc.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        return(nc.ConnectionInfo);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(AskForNewConnection()); // tail recursive retry. user can break out by hitting cancel.
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
        private void AddNewQueryTab()
        {
            using (NewConnection nc = new NewConnection())
            {
                if (nc.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                string msg = null;

                try
                {
                    ConnectionInfo info;
                    bool           alreadyExists = false;
                    alreadyExists = serverList.TryGet(nc.ConnectionInfo.ServerType, nc.ConnectionInfo.Server, nc.ConnectionInfo.UserName, out info);
                    if (!alreadyExists)
                    {
                        info = nc.ConnectionInfo;
                        info.Connect();
                        serverList.Add(info);

                        info.ConnectionClosed += (sender, args) => serverList.Remove(info);
                    }

                    CreateQueryTab(info.Title, info);

                    if (!alreadyExists)
                    {
                        objectExplorer.AddServer(new SwisMetaDataProvider(info), info);
                    }
                }
                catch (FaultException <InfoServiceFaultContract> ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Detail.Message;
                }
                catch (SecurityNegotiationException ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Message;
                }
                catch (FaultException ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                }
                catch (MessageSecurityException ex)
                {
                    log.Error("Failed to connect", ex);
                    if (ex.InnerException != null && ex.InnerException is FaultException)
                    {
                        msg = (ex.InnerException as FaultException).Message;
                    }
                    else
                    {
                        msg = ex.Message;
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Message;
                }

                if (msg != null)
                {
                    msg = string.Format("Unable to connect to Information Service. {0}", msg);
                    MessageBox.Show(this, msg, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 6
0
        public void RunPlayback()
        {
            try
            {
                ShowTabs(Tabs.Log);
                var openFileDialog1 = new OpenFileDialog
                                          {
                                              InitialDirectory = "c:\\",
                                              Filter = "log files (*.log)|*.log|All files (*.*)|*.*",
                                              DefaultExt = "log",
                                              FilterIndex = 2,
                                              RestoreDirectory = true
                                          };


                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    var pbi = new PlaybackItem() { FileName = openFileDialog1.FileName, MultiThread = false, QueryTab = this};
                    using (var nc = new NewConnection())
                    {
                        if (nc.ShowDialog(this) != DialogResult.OK)
                            return;

                        var info = nc.ConnectionInfo;
                        info.Connect();
                        pbi.ConnectionInfo = info;
                        PlaybackManager.StartPlayback(pbi);
                    }
                    logTextbox.Text = "Started Playback...\r\n";
                }
            }
            catch (Exception ex)
            {
                AppendLogTabLine("Error starting playback.\r\n");
                AppendLogTabLine(ex.ToString());
            }
        }
Ejemplo n.º 7
0
        private void AddNewQueryTab()
        {
            using (NewConnection nc = new NewConnection())
            {
                if (nc.ShowDialog(this) != DialogResult.OK)
                    return;

                string msg = null;

                try
                {
                    ConnectionInfo info;
                    bool alreadyExists = false;
                    alreadyExists = serverList.TryGet(nc.ConnectionInfo.ServerType, nc.ConnectionInfo.Server, nc.ConnectionInfo.UserName, out info);
                    if (!alreadyExists)
                    {
                        info = nc.ConnectionInfo;
                        info.Connect();
                        serverList.Add(info);

                        info.ConnectionClosed += (sender, args) => serverList.Remove(info);
                    }

                    CreateQueryTab(info.Title, info);

                    if (!alreadyExists)
                    {
                        objectExplorer.AddServer(new SwisMetaDataProvider(info), info);
                    }
                }
                catch (FaultException<InfoServiceFaultContract> ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Detail.Message;
                }
                catch (SecurityNegotiationException ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Message;
                }
                catch (FaultException ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                }
                catch (MessageSecurityException ex)
                {
                    log.Error("Failed to connect", ex);
                    if (ex.InnerException != null && ex.InnerException is FaultException)
                    {
                        msg = (ex.InnerException as FaultException).Message;
                    }
                    else
                    {
                        msg = ex.Message;
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Failed to connect", ex);
                    msg = ex.Message;
                }

                if (msg != null)
                {
                    msg = string.Format("Unable to connect to Information Service. {0}", msg);
                    MessageBox.Show(this, msg, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }