Ejemplo n.º 1
0
        public void OnModifiedDiffCommand(object parameter)
        {
            if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
            {
                return;
            }
            List <string> error_msg_list = new List <string>();

            foreach (var filepath in SelectedModifiedFilePathList)
            {
                var file_status = GetModifiedStatus(filepath);
                if (file_status == null)
                {
                    continue;
                }
                if (file_status.Status == "Untracked")
                {
                    string filename = System.IO.Path.Combine(gitRepository.GetGitWrapper().GetPath(), filepath);
                    GlobalSetting.GetInstance().ViewFile(filename);
                    continue;
                }
                gitRepository.AddLog(String.Format("Diff {0}", filepath));
                gitRepository.GetGitWrapper().DiffTool(filepath);
            }

            foreach (string error_msg in error_msg_list)
            {
                UIService.ShowMessage(error_msg);
            }
        }
Ejemplo n.º 2
0
        public RepositoryViewModel(string git_repository_path, RepositoryTab repository_tab,
                                   UserControls.PendingTabViewModel pendingTabViewModel,
                                   UserControls.StashTabViewModel stashTabViewModel,
                                   UserControls.BranchTabViewModel branchTabViewModel,
                                   UserControls.TagTabViewModel tagTabViewModel,
                                   UserControls.RemoteTabViewModel remoteTabViewModel)
        {
            DisplayAuthor = GlobalSetting.GetInstance().GetSignature();
            Directory     = git_repository_path;

            git_ = new GitWrapper(Directory, this);

            DirectoryTree        = new DirectoryTreeViewModel(this);
            HistoryTabMember     = new HistoryTabViewModel(this);
            _pendingTabViewModel = pendingTabViewModel;
            _stashTabViewModel   = stashTabViewModel;
            _branchTabViewModel  = branchTabViewModel;
            _tagTabViewModel     = tagTabViewModel;
            _remoteTabViewModel  = remoteTabViewModel;

            StashTabHeader = "Stash";

            repository_tab_ = repository_tab;

            PushCommand          = new DelegateCommand((object parameter) => OnPushCommand());
            OpenExplorerCommand  = new DelegateCommand(OnOpenExplorerCommand);
            OpenGitBashCommand   = new DelegateCommand(OnOpenGitBashCommand);
            RefreshCommand       = new DelegateCommand(async(object parameter) => await Refresh());
            ViewTimelapseCommand = new DelegateCommand((object parameter) => OnViewTimeLapseCommand());
            FetchAllCommand      = new DelegateCommand(async(object parameter) => await OnFetchAllCommand());
            PullCommand          = new DelegateCommand(async(object parameter) => await OnPullCommand());
        }
Ejemplo n.º 3
0
 public void InitDataUser()
 {
     this.Id      = GlobalSetting.GetInstance().UserSelect.Id;
     this.Name    = GlobalSetting.GetInstance().UserSelect.Name;
     this.Age     = GlobalSetting.GetInstance().UserSelect.Age;
     this.Email   = GlobalSetting.GetInstance().UserSelect.Email;
     this.Phone   = GlobalSetting.GetInstance().UserSelect.Phone;
     this.Website = GlobalSetting.GetInstance().UserSelect.Website;
 }
Ejemplo n.º 4
0
        public UsersPageViewModel(IRoutingService navigationService = null)
        {
            // Variables
            _navigationService = navigationService ?? Locator.Current.GetService <IRoutingService>();
            this.Users         = new ObservableCollection <HomeModel>(GlobalSetting.GetInstance().Users);

            // Commands
            SelectUserCommand = new Command <HomeModel>(OnSelectUserCommand);
            BackCommand       = new Command(OnBackCommand);
        }
        /// <summary>
        /// Nos redirije a la lista de usuarios
        /// </summary>
        /// <param name="obj"></param>
        private async void OnListUsersCommand(object obj)
        {
            if (GlobalSetting.GetInstance().Users == null)
            {
                await PageDialog.AlertAsync("No fue posible acceder sin datos, recarga otra vez la pagina", "Error", "Aceptar");

                return;
            }
            await _navigationService.NavigateTo($"///users");
        }
 public void RegisteredUser()
 {
     if (GlobalSetting.GetInstance().UserAuth != null)
     {
         this.IsAuthVisible = true;
         this.Name          = GlobalSetting.GetInstance().UserAuth.Name;
         this.Email         = GlobalSetting.GetInstance().UserAuth.Email;
         this.Phone         = GlobalSetting.GetInstance().UserAuth.Phone;
         this.Website       = GlobalSetting.GetInstance().UserAuth.Website;
     }
 }
        /// <summary>
        /// Valida si se autentico y lo dijire hacia Home
        /// </summary>
        /// <param name="obj"></param>
        private async void OnLoginCommand(object obj)
        {
            var userAuth = GlobalSetting.GetInstance().Users.Find(a => a.Username == this.User && a.Password == this.Pass);

            if (userAuth == null)
            {
                await this.PageDialog.AlertAsync("No se pudo encontrar ningun usuario", "Error", "Aceptar");

                return;
            }
            GlobalSetting.GetInstance().UserAuth = userAuth;
            MessagingCenter.Send("Ok", MessagingKeys.RegisterUser);
            await _navigationService.NavigateTo($"///home");
        }
Ejemplo n.º 8
0
        public NewTabViewModel(Action <string> new_tab_result)
        {
            new_tab_result_ = new_tab_result;

            RepositoryList = new ObservableCollection <string>();

            foreach (string directory_name in GlobalSetting.GetInstance().ConfigModel.RecentRepositoryPaths)
            {
                RepositoryList.Add(directory_name);
            }

            BrowseCommand = new DelegateCommand(OnBrowseCommand);
            OkayCommand   = new DelegateCommand(OnOkayCommand);
        }
        public async void InitHome()
        {
            // Llamamos al servicio API
            this.PageDialog.ShowLoading("Cargando información");
            var apiUsers = await ApiManager.GetDataUsers();

            if (!apiUsers.IsSuccessStatusCode)
            {
                this.PageDialog.HideLoading();
                await PageDialog.AlertAsync("Algo salió mal, no se pueden obtener datos", "Error", "Aceptar");

                return;
            }
            var jsonResponse = await apiUsers.Content.ReadAsStringAsync();

            var responseAlistamiento = await Task.Run(() => JsonConvert.DeserializeObject <List <HomeModel> >(jsonResponse));

            GlobalSetting.GetInstance().Users = responseAlistamiento;
            this.PageDialog.HideLoading();
        }
Ejemplo n.º 10
0
 // Ve el detalle del usuario
 private async void OnSelectUserCommand(HomeModel user)
 {
     GlobalSetting.GetInstance().UserSelect = user;
     MessagingCenter.Send("Ok", MessagingKeys.UserSelected);
     await _navigationService.NavigateTo($"///datauser");
 }