コード例 #1
0
ファイル: CircleUpdater.cs プロジェクト: himapo/ccm
        public CircleUpdater(
            IUpdaterManager updaterService,
            float start,
            float end,
            float finishMilliSeconds,
            Vector2 center,
            Vector2 amplitude,
            Action<float> outputX,
            Action<float> outputY,
            Action callback
            )
        {
            new SinUpdater(
                updaterService,
                start,
                end,
                finishMilliSeconds,
                center.X,
                amplitude.X,
                outputX,
                () => { });

            new SinUpdater(
                updaterService,
                start + 90.0f,
                end + 90.0f,
                finishMilliSeconds,
                center.Y,
                amplitude.Y,
                outputY,
                callback);
        }
コード例 #2
0
ファイル: SinUpdater.cs プロジェクト: himapo/ccm
        public SinUpdater(
            IUpdaterManager updaterService,
            float finishMilliSeconds,
            float start,
            float end,
            float center,
            float amplitude,
            Action<float> output,
            Action callback
            )
        {
            outputFunc = output;
            finishCallback = callback;

            Start = Now = start;
            End = end;
            FinishMilliSeconds = finishMilliSeconds;
            ElapsedMilliSeconds = 0.0f;

            Amplitude = amplitude;
            Center = center;

            outputFunc(Start);

            updaterService.Add(this);
        }
コード例 #3
0
    public AppViewModel(IUpdaterManager updater, IMessageUIManager message, IFileManager file, AppUIManager ui, AppUserData data)
    {
        // Set properties
        Updater = updater ?? throw new ArgumentNullException(nameof(updater));
        Message = message ?? throw new ArgumentNullException(nameof(message));
        File    = file ?? throw new ArgumentNullException(nameof(file));
        UI      = ui ?? throw new ArgumentNullException(nameof(ui));
        Data    = data ?? throw new ArgumentNullException(nameof(data));

        // Flag that the startup has begun
        IsStartupRunning = true;

        // Check if the application is running as administrator
        try
        {
            IsRunningAsAdmin = WindowsHelpers.RunningAsAdmin;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Error");
            IsRunningAsAdmin = false;
        }

        AppTitle = IsRunningAsAdmin ? Resources.AppNameAdmin : Resources.AppName;

        LoadOperation = new Operation(() => IsLoading = true, () => IsLoading = false);

        // Create locks
        SaveUserDataAsyncLock      = new AsyncLock();
        MoveBackupsAsyncLock       = new AsyncLock();
        AdminWorkerAsyncLock       = new AsyncLock();
        OnRefreshRequiredAsyncLock = new AsyncLock();

        // Create commands
        RestartAsAdminCommand        = new AsyncRelayCommand(RestartAsAdminAsync);
        RequestRestartAsAdminCommand = new AsyncRelayCommand(RequestRestartAsAdminAsync);

        // Read the game manager configuration
        var gameConfig = Files.Games;

        // Set up the games manager
        GamesManager = JsonConvert.DeserializeObject <AppGamesManager>(gameConfig, new SimpleTypeConverter())
                       ?? throw new InvalidOperationException("Deserialized game manager is null");
    }
コード例 #4
0
ファイル: CylinderUpdater.cs プロジェクト: himapo/ccm
        public CylinderUpdater(
            IUpdaterManager updaterService,
            float finishMilliSeconds,
            float startDegree,
            float endDegree,
            Vector2 center,
            Vector2 amplitude,
            Action<float> outputX,
            Action<float> outputY,
            float startHeight,
            float endHeight,
            Action<float> outputHeight,
            Action callback
            )
        {
            new SinUpdater(
                updaterService,
                finishMilliSeconds,
                startDegree,
                endDegree,
                center.X,
                amplitude.X,
                outputX,
                () => { });

            new SinUpdater(
                updaterService,
                finishMilliSeconds,
                startDegree + 90.0f,
                endDegree + 90.0f,
                center.Y,
                amplitude.Y,
                outputY,
                () => { });

            new LinearUpdater(
                updaterService,
                finishMilliSeconds,
                startHeight,
                endHeight,
                outputHeight,
                callback);
        }
コード例 #5
0
ファイル: LinearUpdater.cs プロジェクト: himapo/ccm
        public LinearUpdater(
            IUpdaterManager updaterService,
            float finishMilliSeconds,
            float start,
            float end, 
            Action<float> output,
            Action callback
            )
        {
            outputFunc = output;
            finishCallback = callback;

            Start = Now = start;
            End = end;
            FinishMilliSeconds = finishMilliSeconds;
            ElapsedMilliSeconds = 0.0f;

            outputFunc(Start);
            
            updaterService.Add(this);
        }