예제 #1
0
        void refreshCatalogues_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bkgWork = sender as BackgroundWorker;

            try
            {
                bkgWork.ReportProgress(0);

                List <Catalogues> activeConnections = new List <Catalogues>();

                for (int i = 0; i < globalCataloguesCollection.Count; i++)
                {
                    activeConnections.Add(globalCataloguesCollection[i]);
                }

                globalCataloguesCollection.Clear();

                for (int i = 0; i < activeConnections.Count; i++)
                {
                    TDSettings.ConnectionRow connRow = _appSettings.GetConnectionById(activeConnections [i].ConnectionId);

                    Catalogues newCatalogue = null;
                    try
                    {
                        newCatalogue = CatalogueManager.GetCataloguesForUser(connRow, bkgWork);
                    }
                    catch (Exception)
                    {
                        // login failed or another exception
                        // old collection are kept.
                    }

                    // add catalogues per user
                    if (newCatalogue != null)
                    {
                        globalCataloguesCollection.Add(newCatalogue);
                    }
                    else
                    {
                        // keep the old collections
                        globalCataloguesCollection.Add(activeConnections[i]);
                    }

                    string connectionInfo = _appSettings.GetConnectionInfo(connRow.ConnectionId);

                    bkgWork.ReportProgress(1 + i * 90 / activeConnections.Count, connectionInfo);
                }

                bkgWork.ReportProgress(100);
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "refreshCatalogues_DoWork", LoggingCategory.Exception);

                bkgWork.ReportProgress(100);

                throw;
            }
        }
예제 #2
0
 public static CatalogueManager Instance(  )
 {
     if (_instance == null)
     {
         _instance = new CatalogueManager();
     }
     return(_instance);
 }
예제 #3
0
        private void EditBug_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {
                    _appSettings = MyZillaSettingsDataSet.GetInstance();

                    _asyncOpManager = AsyncOperationManagerList.GetInstance();

                    // disable the control until de bug details are loaded and
                    // all the controls are populated accordingly.

                    ShowConnectionInfo();

                    this.Enabled = false;

                    _catalogues = CatalogueManager.Instance();

                    //if (_catalogues.DependentCataloguesLoadedCompleted!=null)
                    _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompleted);

                    cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                    if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null)
                    {
                        cmbComponent.Enabled = false;

                        cmbVersion.Enabled = false;

                        cmbMilestone.Enabled = false;

                        _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted);

                        _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser);
                    }
                    else
                    {
                        PopulateControls();

                        // asyn op
                        GetBugDetailsAndSetControls(this.bugId, true);
                    }

                    if (_appSettings.GetConnectionById(connectionId).Version.StartsWith("2.18"))
                    {
                        GetLastUpdated();
                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "EditBug_Load", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        public static CatalogueManager Instance(  )
        {
            if (_instance == null)
            {
                _instance = new CatalogueManager();

            }
            return _instance;
        }
예제 #5
0
        private void InsertBug_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {
                    MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance();

                    _catalogues = CatalogueManager.Instance();

                    this.txtReporter.Text = _appSettings.GetConnectionById(this.connectionId).UserName;

                    asyncOpManager = AsyncOperationManagerList.GetInstance();

                    cmbConnections.SelectedValueChanged -= new EventHandler(cmbConnections_SelectedValueChanged);

                    LoadConnectionInfo();

                    cmbConnections.Text = _appSettings.GetConnectionInfo(this.connectionId);

                    cmbConnections.SelectedValueChanged += new EventHandler(cmbConnections_SelectedValueChanged);


                    // verify if all catalogues have been added and populate the controls properly

                    cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                    if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null)
                    {
                        cmbComponent.Enabled = false;

                        cmbVersion.Enabled = false;

                        cmbMilestone.Enabled = false;

                        btnInsertBug.Enabled = false;

                        _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted);

                        _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser);
                    }
                    else
                    {
                        _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompletedInsertBug);

                        PopulateControls();
                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "InsertBug_Load", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        private bool CheckConditionsForLoading()
        {
            bool isValid = true;

            CatalogueManager _catalogues = CatalogueManager.Instance();

            Catalogues cataloguesPerUser = _catalogues.GetCataloguesForConnection(_connectionId);

            if (cataloguesPerUser == null)
            {
                return(false);
            }

            return(isValid);
        }
예제 #7
0
        private void bwLoadCatalogues_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            try
            {
                TDSettings.ConnectionRow currentConnection = e.Argument as TDSettings.ConnectionRow;

                Catalogues cataloguesPerUser = CatalogueManager.LoadMainCatalogues(currentConnection, worker);

                e.Result = cataloguesPerUser;
            }
            catch (Exception ex)
            {
                SplashManager.Close(); // just in case

                MyLogger.Write(ex, "bwLoadCatalogues_DoWork", LoggingCategory.Exception);

                worker.ReportProgress(100);

                throw;
            }
        }
예제 #8
0
        void bkgCatalogues_DoWork(object sender, DoWorkEventArgs e)
        {
            SavingData       sp = null;
            BackgroundWorker backgroundWorker = sender as BackgroundWorker;
            ArrayList        result           = new ArrayList();

            try
            {
                ArrayList al = e.Argument as ArrayList;

                TDSettings.ConnectionRow currentConnection = al[0] as TDSettings.ConnectionRow;

                sp = al[1] as SavingData;

                Catalogues cataloguesPerUser = CatalogueManager.GetCataloguesForUser(currentConnection, backgroundWorker);

                result.Add(cataloguesPerUser);

                result.Add(sp);

                e.Result = result;
            }
            catch (Exception ex)
            {
                sp.ErrorMessage = ex.Message;

                sp.Operation = OperationType.LogOnFailed;

                MyLogger.Write(ex, "bkgCatalogues_DoWork", LoggingCategory.Exception);

                SplashManager.Close(); // just in case

                backgroundWorker.ReportProgress(100);

                throw new CustomException(sp, String.Empty, ex);
            }
        }
예제 #9
0
        public MainForm()
        {
            try
            {

                InitializeComponent();

                _appSettings = MyZillaSettingsDataSet.CreateInstance(Utils.UserAppDataPath);

                ScreenSize = Screen.GetWorkingArea(this);

                settings = _appSettings.GetGlobalSettings(ScreenSize);

                int splasherTop;
                int splasherLeft;

                if (settings.MainFormMaximized)
                {
                    splasherTop = (ScreenSize.Height) / 2;

                    splasherLeft = (ScreenSize.Width) / 2;

                    this.WindowState = FormWindowState.Maximized;

                }
                else
                {
                    splasherTop = settings.MainFormTop + settings.MainFormHeight / 2;

                    splasherLeft = settings.MainFormLeft + settings.MainFormWidth / 2;

                }

                SplashManager.Show(typeof(FormSplash), splasherTop, splasherLeft);

                tBSI.OnRemoveTabEventHandler += new RemovingTabEventHandler(tBSI_OnRemoveTab);

                //if application fails to created needed folders, application will be closed
                if (String.IsNullOrEmpty(Utils.UserAppDataPath))
                    this.Close();

                //Subscribe to the manager of the async operations
                _asyncOpManager = AsyncOperationManagerList.GetInstance();
                _asyncOpManager.RefreshAsyncOperationListEvent += new EventHandler(asyncOpManager_RefreshAsyncOpListEvent);
                _asyncOpManager.RefreshAsyncOperationListEvent += new EventHandler(_asyncOpManager_SplashRefreshAsyncOpListEvent);

                //Subscribe to the catalogue manager
                _catalogManager = CatalogueManager.Instance();

                _catalogManager.CatalogueEvent += new CatalogueManager.CataloguesEventHandler(_catalogManager_CatalogueEvent);

                Utils.FormContainer = this;

            //                Splasher.Show(typeof(FormSplash), splasherTop, splasherLeft);
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "MainForm", LoggingCategory.Exception);

                SplashManager.Close();

                MessageBox.Show(ex.Message);

                this.Close();
            }
        }
예제 #10
0
        private void numRefreshCatalogues_Click(object sender, EventArgs e)
        {
            try
            {

                if (_catalogManager.Count() > 0)
                {
                    // show loading form.
                    Utils.ActivateLoadingForm();

                    _catalogManager = CatalogueManager.Instance();

                    _catalogManager.RefreshCatalogues();

                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "numRefreshCatalogues_Click", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #11
0
        private void EditBug_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {

                    _appSettings = MyZillaSettingsDataSet.GetInstance();

                    _asyncOpManager = AsyncOperationManagerList.GetInstance();

                    // disable the control until de bug details are loaded and
                    // all the controls are populated accordingly.

                    ShowConnectionInfo();

                    this.Enabled = false;

                    _catalogues = CatalogueManager.Instance();

                    //if (_catalogues.DependentCataloguesLoadedCompleted!=null)
                        _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompleted);

                    cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                    if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null )
                    {
                        cmbComponent.Enabled = false;

                        cmbVersion.Enabled = false;

                        cmbMilestone.Enabled = false;

                        _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted);

                        _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser);
                    }
                    else
                    {

                        PopulateControls();

                        // asyn op
                        GetBugDetailsAndSetControls(this.bugId, true);
                    }

                    if (_appSettings.GetConnectionById(connectionId).Version.StartsWith("2.18"))
                        GetLastUpdated();
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "EditBug_Load", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error , MessageBoxButtons.OK, MessageBoxIcon.Error     );
            }
        }
예제 #12
0
        public static string CheckIfValidConnection()
        {
            string result = string.Empty;

            if (_catManager == null)
            {
                _catManager = CatalogueManager.Instance();
            }

            Catalogues catalogues = _catManager.GetCataloguesForConnection(Utils.ConnectionId);

            if (catalogues == null)
            {
                // get the connection info
                if (_appSettings == null)
                {
                    _appSettings = MyZillaSettingsDataSet.GetInstance();
                }

                string connInfo = _appSettings.GetConnectionInfo(Utils.ConnectionId);

                result = string.Format(Messages.NoActiveConnection, connInfo);

            }

            return result;
        }
예제 #13
0
        private void InsertBug_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.DesignMode)
                {

                    MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance();

                    _catalogues = CatalogueManager.Instance();

                    this.txtReporter.Text = _appSettings.GetConnectionById(this.connectionId).UserName;

                    asyncOpManager = AsyncOperationManagerList.GetInstance();

                    cmbConnections.SelectedValueChanged -=new EventHandler(cmbConnections_SelectedValueChanged);

                    LoadConnectionInfo();

                    cmbConnections.Text = _appSettings.GetConnectionInfo(this.connectionId);

                    cmbConnections.SelectedValueChanged += new EventHandler(cmbConnections_SelectedValueChanged);

                    // verify if all catalogues have been added and populate the controls properly

                    cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId);

                    if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null )
                    {
                        cmbComponent.Enabled = false;

                        cmbVersion.Enabled = false;

                        cmbMilestone.Enabled = false;

                        btnInsertBug.Enabled = false;

                        _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted);

                        _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser);
                    }
                    else
                    {

                        _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompletedInsertBug);

                        PopulateControls();

                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Write(ex, "InsertBug_Load", LoggingCategory.Exception);

                MessageBox.Show(this, ex.Message, Messages.Error , MessageBoxButtons.OK, MessageBoxIcon.Error     );
            }
        }