Exemple #1
0
        internal static void Main()
        {
            SetUnhandledExceptions();
            Info.SetApplicationVersion();

            Logging.Info(String.Format("-------------------------------Title: {0} started Version:{1} Date:{2}-------------------------------",
                                       Info.TitleVersion, Info.DLLVersion, Info.BuildDate));
            Logging.Info("Start state 1 Complete: Unhandled exceptions");

            LogGeneralProperties();
            Logging.Info("Start state 2 Complete: Log General properties");

            SetApplicationProperties();
            Logging.Info("Start state 3 Complete: Set application properties");

            var             settings    = Settings.Instance;
            CommandLineArgs commandLine = ParseCommandline(settings);

            Logging.Info("Start state 4 Complete: Parse command line");

            if (!EnsureDataAreWriteAble())
            {
                return;
            }
            Logging.Info("Start state 5 Complete: User account control");

            if (commandLine.SingleInstance && SingleInstanceApplication.Instance.NotifyExisting(commandLine))
            {
                return;
            }

            Logging.Info("Start state 6 Complete: Set Single instance mode");


            var connectionManager  = new ConnectionManager(new PluginsLoader(settings));
            var favoriteIcons      = new FavoriteIcons(connectionManager);
            var persistenceFactory = new PersistenceFactory(settings, connectionManager, favoriteIcons);
            // do it before config update, because it may import favorites from previous version
            IPersistence persistence = persistenceFactory.CreatePersistence();

            Logging.Info("Start state 7 Complete: Initilizing Persistence");

            TryUpdateConfig(settings, persistence, connectionManager);
            Logging.Info("Start state 8 Complete: Configuration upgrade");

            ShowFirstRunWizard(settings, persistence, connectionManager);
            var startupUi = new StartupUi();

            persistence = persistenceFactory.AuthenticateByMasterPassword(persistence, startupUi, commandLine.masterPassword);
            PersistenceErrorForm.RegisterDataEventHandler(persistence.Dispatcher);

            RunMainForm(persistence, connectionManager, favoriteIcons, commandLine);

            Logging.Info(String.Format("-------------------------------{0} Stopped-------------------------------",
                                       Info.TitleVersion));
        }
        internal void LoadEvents(IPersistence persistence, FavoriteIcons favoriteIcons)
        {
            this.persistence    = persistence;
            this.favoriteIcons  = favoriteIcons;
            this.toolTipBuilder = new ToolTipBuilder(this.persistence.Security);
            var iconsBuilder = new ProtocolImageListBuilder(favoriteIcons.GetProtocolIcons);

            iconsBuilder.Build(this.protocolsImageList);
            this.LoadAll();
        }
Exemple #3
0
        public void SetUp()
        {
            this.propertiesControl = new FavoritePropertiesControl();
            Mock <IPersistence> persistenceStub = TestMocksFactory.CreatePersistence();

            persistenceStub.SetupGet(p => p.Factory)
            .Returns(new Mock <IFactory>().Object);
            this.irelevantPersistence = persistenceStub.Object;
            FavoriteIcons favoriteIcons = TestConnectionManager.CreateTestFavoriteIcons();

            this.propertiesControl.AssignServices(this.irelevantPersistence, TestConnectionManager.Instance, favoriteIcons);
        }
Exemple #4
0
        /// <summary>
        /// Dont call from constructor to support designer
        /// </summary>
        internal void Load(IPersistence persistence, FavoriteIcons favoriteIcons)
        {
            this.persistence    = persistence;
            this.favoriteIcons  = favoriteIcons;
            this.toolTipBuilder = new ToolTipBuilder(this.persistence.Security);
            var connectionHistory = this.persistence.ConnectionHistory;

            connectionHistory.HistoryRecorded += new HistoryRecorded(this.HistoryRecorded);
            connectionHistory.HistoryClear    += new Action(this.ConnectionHistory_HistoryClear);

            var iconsBuilder = new ProtocolImageListBuilder(favoriteIcons.GetProtocolIcons);

            iconsBuilder.Build(this.imageListIcons);

            // init groups before loading the history to prevent to run the callback earlier
            InitializeTimeLineTreeNodes();
        }
Exemple #5
0
 /// <summary>
 /// Create root level container. Parent is not defined. This is an entry point of the update.
 /// </summary>
 internal FavoritesLevelUpdate(FavoriteIcons favoriteIcons, TreeNodeCollection nodes, FavoritesChangedEventArgs changes,
                               ToolTipBuilder toolTipBuilder)
     : base(favoriteIcons, nodes, changes, toolTipBuilder)
 {
 }
Exemple #6
0
 public AddConnectionForm(IPersistence persistence, FavoriteIcons favoriteIcons)
 {
     this.persistence   = persistence;
     this.favoriteIcons = favoriteIcons;
     InitializeComponent();
 }
Exemple #7
0
 internal DbFavoriteImagesStore(DataDispatcher dispatcher, FavoriteIcons favoriteIcons)
 {
     this.dispatcher    = dispatcher;
     this.favoriteIcons = favoriteIcons;
 }