Exemplo n.º 1
0
        /// <summary>Standard constructor for the tool window.</summary>
        public toolSpiraExplorer() :
            base(null)
        {
            try
            {
                // Set the window title reading it from the resources.
                this.Caption = StaticFuncs.getCultureResource.GetString("app_Tree_Name");
                // Set the image that will appear on the tab of the window frame
                // when docked with an other window
                // The resource ID correspond to the one defined in the resx file
                // while the Index is the offset in the bitmap strip. Each image in
                // the strip being 16x16.
                this.BitmapResourceID = 301;
                this.BitmapIndex      = 0;

                // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
                // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
                // the object returned by the Content property.

                cntlSpiraExplorer explorerWindow = new cntlSpiraExplorer();
                explorerWindow.Pane = this;

                base.Content = explorerWindow;
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "ShowToolWindow()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public SolutionEventsListener(cntlSpiraExplorer explorer)
        {
            this.spiraExplorer = explorer;
            InitNullEvents();

            solution = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;

            if (solution != null)
            {
                solution.AdviseSolutionEvents(this, out solutionEventsCookie);
            }
        }
        public override void OnToolWindowCreated()
        {
            cntlSpiraExplorer explorerWindow = (cntlSpiraExplorer)base.Content;

            if (explorerWindow != null)
            {
                SpiraProperties spiraProperties = new SpiraProperties(explorerWindow);
                ArrayList       listObjects     = new ArrayList();
                listObjects.Add(spiraProperties);
                SelectList(listObjects);
            }
        }
        /// <summary>Creates a new instance of the control.</summary>
        public cntlSpiraExplorer()
        {
            try
            {
                //Overall initialization.
                InitializeComponent();

                instance = this;

                //Set button images and events.
                // - Config button
                Image btnConfigImage = Business.StaticFuncs.getImage("imgSettings", new Size(16, 16));
                btnConfigImage.Stretch = Stretch.None;
                this.btnConfig.Content = btnConfigImage;

                // Auto Refresh Button
                Image btnAutoRefreshImage = Business.StaticFuncs.getImage("imgRefresh", new Size(16, 16));
                btnAutoRefreshImage.Stretch = Stretch.None;
                this.btnAutoRefresh.Content = btnAutoRefreshImage;

                Image btnNewTaskImage = Business.StaticFuncs.getImage("imgNewTask", new Size(16, 16));
                btnNewTaskImage.Stretch = Stretch.None;
                this.btnNewTask.Content = btnNewTaskImage;
                // - Set bar color.
                this.barLoading.Foreground = (Brush) new System.Windows.Media.BrushConverter().ConvertFrom(StaticFuncs.getCultureResource.GetString("app_Colors_StyledBarColor"));

                //Set datasource.
                this._Projects = new List <TreeViewArtifact>();
                this.trvProject.Items.Clear();
                this.trvProject.ItemsSource = this._Projects;

                //Load nodes.
                this.CreateStandardNodes();

                //If a solution is loaded now, get the loaded solution.
                if (Business.StaticFuncs.GetEnvironment.Solution.IsOpen)
                {
                    this.loadSolution((string)Business.StaticFuncs.GetEnvironment.Solution.Properties.Item("Name").Value);
                }
                else
                {
                    this.loadSolution(null);
                }
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, ".ctor()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }