Пример #1
0
        public AddNewServerForm(ServerDetails server)
        {
            _editMode = true;
            _server = server;

            XmlSerializer s = new XmlSerializer(typeof(ServerDetails));
            s.Serialize(_memoryStream, server);

            InitializeComponent();
        }
Пример #2
0
        /// <summary>
        /// Returns an <see cref="ITrac"/> instance which is connected to a <see cref="ServerDetails"/> object.
        /// </summary>
        /// <param name="serverDetails"></param>
        /// <returns></returns>
        public static ITrac GetTrac(ServerDetails serverDetails)
        {
            ITrac trac = XmlRpcProxyGen.Create<ITrac>();
            trac.Proxy = WebRequest.DefaultWebProxy;
            trac.Url = serverDetails.XmlRpcUrl();

            switch (serverDetails.RequiredAuthentication)
            {
                case AuthenticationTypes.BasicAuthentication:
                    trac.Credentials = new NetworkCredential(serverDetails.Username, serverDetails.Password);
                    break;
                case AuthenticationTypes.IntegratedAuthentication:
                    trac.Credentials = CredentialCache.DefaultNetworkCredentials;
                    break;
                case AuthenticationTypes.ClientCertAuthentication:
                    try
                    {
                        X509Store s = new X509Store(StoreName.My, StoreLocation.CurrentUser);
                        X509Certificate2Collection col;

                        s.Open(OpenFlags.ReadOnly);
                        col = s.Certificates.Find(X509FindType.FindBySubjectName, serverDetails.Username, true);
                        if (col.Count == 1)
                        {
                            trac.ClientCertificates.Add(col[0]);
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("No or multiple (" + col.Count + ") certificate with name [" + serverDetails.Username + "] found.");
                        }
                        s.Close();
                    }
                    catch (System.Security.Cryptography.CryptographicException s)
                    {
                        System.Windows.Forms.MessageBox.Show("CryptographicException: " + s.ToString());
                    }
                    catch (System.Security.SecurityException s)
                    {
                        System.Windows.Forms.MessageBox.Show("SecurityException: " + s.ToString());
                    }
                    catch (System.ArgumentException s)
                    {
                        System.Windows.Forms.MessageBox.Show("ArgumentException: " + s.ToString());
                    }
                    break;
                case AuthenticationTypes.None:
                    trac.Credentials = null;
                    break;
            }

            return trac;
        }
Пример #3
0
 private void OpenInBrowser(int id)
 {
     try
     {
         if (TracConnect != null)
         {
             TracConnect.OpenBrowser(ServerDetails.TicketUrl(id));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
        public void CreateTicketWindow(ServerDetails serverDetails, TicketQueryDefinition ticketDef, string guid)
        {
            Windows2 windows2 = (Windows2)_applicationObject.Windows;
            Assembly asm = Assembly.GetExecutingAssembly();

            object customControl = null;
            string className = "TracExplorer.Common.TicketView";
            string caption = ticketDef.Name;

            if (guid == null)
            {
                // Generate new guid
                guid = Guid.NewGuid().ToString("B");
            }

            string asmLocation = asm.Location;
            asmLocation = asmLocation.Replace("VSTrac.dll", "Common.dll");

            Window toolWindow = windows2.CreateToolWindow2(_addInInstance, asmLocation, className,
                                                     caption, guid, ref customControl);

            Image customToolWindowTabImage = GetCustomToolWindowTabImage();
            toolWindow.SetTabPicture(Support.ImageToIPicture(customToolWindowTabImage));

            if (customControl != null)
            {
                ((TicketView)customControl).TicketQueryUpdate += new TicketView.TicketQueryUpdateEvent(Connect_TicketQueryUpdate);
                ((TicketView)customControl).TracConnect = this;
                ((TicketView)customControl).ServerDetails = serverDetails;
                ((TicketView)customControl).TicketDefinition = ticketDef;
                ((TicketView)customControl).ParentWindow = toolWindow;
                ((TicketView)customControl).RunQuery();
            }

            toolWindow.Visible = true;

            // Add TicketWindow informations to reload window after restart
            if (_ticketWindowList == null)
            {
                _ticketWindowList = new List<TicketWindowDefinition>();
            }
            TicketWindowDefinition definition = new TicketWindowDefinition();
            definition.Guid = guid;
            definition.ServerName = serverDetails.Server;
            definition.TicketQueryName = ticketDef.Name;
            definition.ToolWindow = toolWindow;

            _ticketWindowList.Add(definition);
        }
            public ServerNode(ServerDetails serverDetails) : base(serverDetails.Server, 1, 1)
            {
                this.ServerDetails = serverDetails;

                try
                {
                    nodeWikiPages  = new WikiPagesNode(serverDetails);
                    nodeTickets    = new TicketsNode(serverDetails);
                    nodeAttributes = new AttributesNode(serverDetails);

                    this.Nodes.Add(nodeWikiPages);
                    this.Nodes.Add(nodeTickets);
                    this.Nodes.Add(nodeAttributes);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
Пример #6
0
        /// <summary>
        /// Returns an <see cref="ITrac"/> instance which is connected to a <see cref="ServerDetails"/> object.
        /// </summary>
        /// <param name="serverDetails"></param>
        /// <returns></returns>
        public static ITrac GetTrac(ServerDetails serverDetails)
        {
            ITrac trac = XmlRpcProxyGen.Create<ITrac>();
            trac.Proxy = WebRequest.DefaultWebProxy;
            trac.Url = serverDetails.XmlRpcUrl();

            switch (serverDetails.RequiredAuthentication)
            {
                case AuthenticationTypes.BasicAuthentication:
                    trac.Credentials = new NetworkCredential(serverDetails.Username, serverDetails.Password);
                    break;
                case AuthenticationTypes.IntegratedAuthentication:
                    trac.Credentials = CredentialCache.DefaultNetworkCredentials;
                    break;
                case AuthenticationTypes.None:
                    trac.Credentials = null;
                    break;
            }

            return trac;
        }
Пример #7
0
 public AddNewServerForm()
 {
     _server = new ServerDetails();
     InitializeComponent();
 }
Пример #8
0
 public void CreateTicketWindow(ServerDetails serverDetails, TicketQueryDefinition ticketDef, string guid)
 {
     // Not implemented!
 }
Пример #9
0
 public AddNewServerForm()
 {
     _server = new ServerDetails();
     InitializeComponent();
 }
Пример #10
0
 private void wizard1_CloseFromCancel(object sender, CancelEventArgs e)
 {
     if (_editMode)
     {
         // Reload values from memory
         XmlSerializer s = new XmlSerializer(typeof(ServerDetails));
         _memoryStream.Position = 0;
         _server = (ServerDetails)s.Deserialize(_memoryStream);
     }
     this.Close();
 }
Пример #11
0
 public WikiPagesNode(ServerDetails serverDetails)
 {
     this.Text = Properties.Resources.NodeWikiPages;
     this.ImageIndex = this.SelectedImageIndex = 2;
     this.ServerDetails = serverDetails;
 }
Пример #12
0
            public TicketsNode(ServerDetails serverDetails)
            {
                this.Text = Properties.Resources.NodeTickets;
                this.ImageIndex = this.SelectedImageIndex = 2;
                this.ServerDetails = serverDetails;

                this.Refresh();
            }
Пример #13
0
            public TicketNode(ServerDetails serverDetails, TicketQueryDefinition ticketQueryDefinition)
            {
                this.Text = ticketQueryDefinition.Name;
                this.ImageIndex = this.SelectedImageIndex = 3;

                this.ServerDetails = serverDetails;
                this.TicketDefinition = ticketQueryDefinition;
            }
Пример #14
0
            public ServerNode(ServerDetails serverDetails)
                : base(serverDetails.Server, 1, 1)
            {
                this.ServerDetails = serverDetails;

                try
                {
                    nodeWikiPages = new WikiPagesNode(serverDetails);
                    nodeTickets = new TicketsNode(serverDetails);
                    nodeAttributes = new AttributesNode(serverDetails);

                    this.Nodes.Add(nodeWikiPages);
                    this.Nodes.Add(nodeTickets);
                    this.Nodes.Add(nodeAttributes);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
 public AttributesNode(ServerDetails serverDetails)
 {
     this.Text          = Properties.Resources.NodeAttributes;
     this.ImageIndex    = this.SelectedImageIndex = 2;
     this.ServerDetails = serverDetails;
 }
Пример #16
0
 public TicketQueryArgs(ServerDetails serverDetails, TicketQueryDefinition ticketQuery)
 {
     _ticketQuery = ticketQuery;
     _serverDetails = serverDetails;
 }
Пример #17
0
 public TicketQueryArgs(ServerDetails serverDetails, TicketQueryDefinition ticketQuery)
 {
     _ticketQuery   = ticketQuery;
     _serverDetails = serverDetails;
 }