コード例 #1
0
        public async Task GitSync()
        {
            if (!IsDestinationFolderSet())
            {
                return;
            }

            try
            {
                GitGetRemote();
                GitOutput = "Start sync...";

                StartWorking("Sync");

                GitResult pullResult = await GitProcess.ExcecuteASync(DestinationFolder, "pull origin master");

                if (pullResult.ExitCode != 0)
                {
                    GitOutput = pullResult.Output;
                }

                GitResult pushResult = await GitProcess.ExcecuteASync(DestinationFolder, "push");

                if (pushResult.ExitCode == 0)
                {
                    GitOutput = string.Format("Succesfully pulled and pushed from server\n{0}", pushResult.Output);
                }
                else
                {
                    GitOutput = pushResult.Output;
                }
            }
            catch (Exception ex)
            {
                _dialogService.ShowErrorMessage("Git Status Error", ex.Message);
            }
            finally
            {
                StopWorking();
            }
        }