Esempio n. 1
0
        /// <summary>
        /// Displays the root View.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
        {
            IExtendedWindowManager windowManager       = new ExtendedWindowManager();
            ILastFMClientFactory   lastFMClientFactory = new LastFMClientFactory();
            IScrobblerFactory      scrobblerFactory    = new ScrobblerFactory();
            ILocalFileFactory      localFileFactory    = new LocalFileFactory();
            IFileOperator          fileOperator        = new FileOperator();
            IDirectoryOperator     directoryOperator   = new DirectoryOperator();
            ISerializer <User>     userSerializer      = new DCSerializer <User>();
            MainViewModel          mainVM = new MainViewModel(windowManager, lastFMClientFactory, scrobblerFactory, localFileFactory, fileOperator, directoryOperator, userSerializer);

            windowManager.ShowWindow(new SystemTrayViewModel(windowManager, mainVM));
        }
Esempio n. 2
0
    /// <summary>
    /// 加载TextAsset资源文件(仅仅适用于特定格式的Json 文件)
    /// </summary>
    /// <param name="assetPath">资源相对于Resource的路径</param>
    /// <param name="fileType">配置文件的类型</param>
    /// <param name="callback"></param>
    public void LoadTextAsset(string assetPath, System.Action <LocalFileBase> callback, LocalFileTypeEnum fileType = LocalFileTypeEnum.ObjectSimpleVale)
    {
        if (m_AllLoadLocalFileDic.ContainsKey(assetPath))
        {
            if (callback != null)
            {
                callback(m_AllLoadLocalFileDic[assetPath]);
            }
            return;
        }

        LoadAsset(assetPath, (obj) => {
            if (obj == null)
            {
                if (callback != null)
                {
                    callback(null);
                }
                return;
            }

            TextAsset asset = obj as TextAsset;
            if (asset == null)
            {
                Debug.LogError("加载TextAsset 失败 " + assetPath);
                if (callback != null)
                {
                    callback(null);
                }
                return;
            }
            LocalFileBase localFile = LocalFileFactory.GetInstance().GetLocalFileBase(fileType, assetPath, asset.text);
            if (localFile == null)
            {
                Debug.LogError("生成本地文件失败 " + assetPath);
                if (callback != null)
                {
                    callback(null);
                }
                return;
            }
            m_AllLoadLocalFileDic.Add(assetPath, localFile);
            if (callback != null)
            {
                callback(localFile);
            }
        });
    }
        /// <summary>
        /// Displays the root View.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
        {
            IExtendedWindowManager windowManager     = new ExtendedWindowManager();
            ILastFMClient          client            = new LastFMClient(APIKEY, APISECRET);
            IScrobblerFactory      scrobblerFactory  = new ScrobblerFactory();
            ILocalFileFactory      localFileFactory  = new LocalFileFactory();
            IFileOperator          fileOperator      = new FileOperator();
            IDirectoryOperator     directoryOperator = new DirectoryOperator();
            ISerializer            userSerializer    = new DCSerializer();
            ILogger         logger         = new Logger("log.txt");
            IGitHubClient   gitHubClient   = new GitHubClient(new ProductHeaderValue("Last.fm-Scrubbler-WPF"));
            IProcessManager processManager = new ProcessManager();
            MainViewModel   mainVM         = new MainViewModel(windowManager, client, scrobblerFactory, localFileFactory, fileOperator,
                                                               directoryOperator, userSerializer, logger, gitHubClient, processManager);

            windowManager.ShowWindow(new SystemTrayViewModel(windowManager, mainVM));
        }
Esempio n. 4
0
        /// <summary>
        /// Displays the root View.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
        {
            IExtendedWindowManager windowManager     = new ExtendedWindowManager();
            ILastFMClient          client            = new LastFMClient(APIKEY, APISECRET);
            IScrobblerFactory      scrobblerFactory  = new ScrobblerFactory();
            ILocalFileFactory      localFileFactory  = new LocalFileFactory();
            IFileOperator          fileOperator      = new FileOperator();
            IDirectoryOperator     directoryOperator = new DirectoryOperator();
            ISerializer            userSerializer    = new DCSerializer();
            ILogger                logger            = new Logger("log.txt");
            IGitHubClient          gitHubClient      = new GitHubClient(new ProductHeaderValue("Last.fm-Scrubbler-WPF"));
            IProcessManager        processManager    = new ProcessManager();
            IDiscogsDataBaseClient discogsClient     = new DiscogsClient.DiscogsClient(new TokenAuthenticationInformation("vcrTuxlCPCANcLDUDcbGSYBxbODkeyywIUtYAMxg"));

            MainViewModel mainVM = new MainViewModel(windowManager, client, scrobblerFactory, localFileFactory, fileOperator,
                                                     directoryOperator, userSerializer, logger, gitHubClient, processManager, discogsClient);

            windowManager.ShowWindow(new SystemTrayViewModel(windowManager, mainVM));
        }