コード例 #1
0
        public void Init(object gameInstance)
        {
            Utilities.UpdateChecker Checker = new Utilities.UpdateChecker(false);
            Task UpdateChecker = new Task(() => Checker.PingUpdateServer());

            UpdateChecker.Start();



            Patches.GetPatches();
            TryShow("Running Seamless Client Plugin v[" + Version + "]");
            PingTimer.Elapsed += PingTimer_Elapsed;
            PingTimer.Start();
        }
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        public PatchVersionSelectionViewModel(Window parentWindow, UserControl control) : base(parentWindow)
        {
            Patches patches = new Patches();

            AllPatches = patches.GetPatches();

            IProgressCommand  downloadPatchesCommand = new DownloadAllPatchesCommand(settingManager);
            ProgressBarDialog dialog = new ProgressBarDialog();

            if (dialog.DataContext is ProgressBarDialogViewModel progressViewModel)
            {
                downloadPatchesCommand.ProgressChanged += (sender, data) =>
                {
                    progressViewModel.UpdateProgress(data.CurrentWorkload, data.TotalWorkload);
                };
                downloadPatchesCommand.Executed += (sender, data) =>
                {
                    progressViewModel.UpdateProgress(100, 100);
                };
            }
            DownloadAllPatches = new MultiCommand(new List <ICommand>()
            {
                downloadPatchesCommand,
                new OpenCustomPopupWindowCommand(currentWindow, FontAwesomeIcon.Hourglass, "Downloading all patches", dialog, false, null)
            });

            object dockArea = control.FindName("DP_InnerDock");

            object controllerDock = control.FindName("IC_PatchSelectionControl");

            if (dockArea is DockPanel panel && controllerDock is ItemsControl controller)
            {
                panelToUse            = panel;
                OpenLaunchGameCommand = new OpenLaunchUserControlToPanel(
                    panelToUse,
                    new LaunchGameUserControl(parentWindow),
                    controller
                    );
            }
        }