Exemplo n.º 1
0
        private void OnSettingAuthor(object sender, EventArgs e)
        {
            DoubleInput conform = new DoubleInput();

            conform.Text          = "Git author setting";
            conform.label1.Text   = "Username";
            conform.label2.Text   = "E-mail";
            conform.ConfirmEvent += (sd, author, email) => {
                if (author == "")
                {
                    MessageBox.Show("Username can't be empty.");
                    return;
                }
                if (email == "")
                {
                    MessageBox.Show("E-mail can't be empty.");
                    return;
                }
                string reg = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                Regex  r   = new Regex(reg);
                if (!r.IsMatch(email))
                {
                    MessageBox.Show("E-mail is not a email.");
                    return;
                }

                GH_SettingsServer sserver = new GH_SettingsServer("ggit");
                sserver.SetValue("author", author);
                sserver.SetValue("email", email);
                sserver.WritePersistentSettings();

                conform.Close();
            };
            conform.Show(ActiveCanvas.FindForm());
        }
Exemplo n.º 2
0
 public override void SetCanvas(ActiveCanvas active)
 {
     if (!OnHomeScreen || _myCanvas == null)
     {
         return;
     }
     base.SetCanvas(active);
 }
Exemplo n.º 3
0
        private async void OnPush(object sender, EventArgs e)
        {
            LoadingForm loadingForm = new LoadingForm();

            loadingForm.Show(ActiveCanvas.FindForm());

            await Task.Run(() => DocumentPush());

            loadingForm.Close();
        }
Exemplo n.º 4
0
        private async void OnPull(object sender, EventArgs e)
        {
            LoadingForm loadingForm = new LoadingForm();

            loadingForm.Show(ActiveCanvas.FindForm());

            await Task.Run(() => PullRepository());

            loadingForm.Close();
        }
Exemplo n.º 5
0
    public void SwitchCanvases(ActiveCanvas act)
    {
        canvas = act;
        switch (act)
        {
        case ActiveCanvas.inGame:
            MenuCanvas.gameObject.SetActive(false);
            InventoryCanvas.gameObject.SetActive(false);
            StateCanvas.gameObject.SetActive(false);
            QuestCanvas.gameObject.SetActive(false);
            OptionCanvas.gameObject.SetActive(false);
            if (inventory != null)
            {
                inventory.inInventory = false;
            }

            break;

        case ActiveCanvas.menu:
            MenuCanvas.gameObject.SetActive(true);
            break;

        case ActiveCanvas.inventory:
            InventoryCanvas.gameObject.SetActive(true);
            StateCanvas.gameObject.SetActive(false);
            QuestCanvas.gameObject.SetActive(false);
            OptionCanvas.gameObject.SetActive(false);
            break;

        case ActiveCanvas.stats:
            InventoryCanvas.gameObject.SetActive(false);
            StateCanvas.gameObject.SetActive(true);
            QuestCanvas.gameObject.SetActive(false);
            OptionCanvas.gameObject.SetActive(false);
            break;

        case ActiveCanvas.quest:
            InventoryCanvas.gameObject.SetActive(false);
            StateCanvas.gameObject.SetActive(false);
            QuestCanvas.gameObject.SetActive(true);
            OptionCanvas.gameObject.SetActive(false);
            break;

        case ActiveCanvas.options:
            InventoryCanvas.gameObject.SetActive(false);
            StateCanvas.gameObject.SetActive(false);
            QuestCanvas.gameObject.SetActive(false);
            OptionCanvas.gameObject.SetActive(true);
            break;

        case ActiveCanvas.exit:
            // go back to main menu
            break;
        }
    }
Exemplo n.º 6
0
 public override void SetCanvas(ActiveCanvas active)
 {
     if (!GameIsPaused && NoResolvePopUps)
     {
         base.SetCanvas(IsControlBar ? ActiveCanvas.Yes : active);
     }
     else
     {
         base.SetCanvas(active);
     }
 }
Exemplo n.º 7
0
    private void ActivateChildTabBranches(ActiveCanvas activeCanvas)
    {
        if (HasChildTabBranches())
        {
            _myBranch.LastSelected.ToggleData.ReturnTabBranch.SetCanvas(activeCanvas);
        }

        bool HasChildTabBranches()
        {
            return(_myBranch.LastSelected.IsToggleGroup && _myBranch.LastSelected.ToggleData.ReturnTabBranch);
        }
    }
Exemplo n.º 8
0
    public virtual void SetCanvas(ActiveCanvas active)
    {
        _myCanvas.enabled = active == ActiveCanvas.Yes;

        if (active == ActiveCanvas.Yes)
        {
            AddThisBranch?.Invoke(this);
        }
        else
        {
            RemoveThisBranch?.Invoke(this);
        }
    }
Exemplo n.º 9
0
        private void OnClone(object sender, EventArgs e)
        {
            DoubleInput cloneForm = new DoubleInput();

            cloneForm.Text = "Clone remote repository";

            cloneForm.label1.Text = "Remote Url";
            cloneForm.label2.Text = "Local Path";

            cloneForm.input2.Cursor   = Cursors.Hand;
            cloneForm.input2.Text     = "Click me !";
            cloneForm.input2.ReadOnly = true;
            cloneForm.input2.Click   += (ed, eg) =>
            {
                if (cloneForm.input1.Text == "")
                {
                    MessageBox.Show("No remote url found");
                    return;
                }
                FolderBrowserDialog folder = new FolderBrowserDialog();
                DialogResult        res    = folder.ShowDialog();
                if (res == DialogResult.OK || res == DialogResult.Yes)
                {
                    Uri    uri  = new Uri(cloneForm.input1.Text);
                    string name = uri.Segments[uri.Segments.Length - 1].TrimEnd('/').Split('.')[0];
                    cloneForm.input2.Text = Path.Combine(@folder.SelectedPath, name);
                }
            };

            cloneForm.Show();

            cloneForm.ConfirmEvent += async(sd, url, path) =>
            {
                LoadingForm loadingForm = new LoadingForm();
                loadingForm.Show(ActiveCanvas.FindForm());
                await Task.Run(() => CloneRepository(url, path));

                loadingForm.Close();
                cloneForm.Close();
                Uri    uri  = new Uri(url);
                string name = uri.Segments[uri.Segments.Length - 1].TrimEnd('/').Split('.')[0];
                MessageBox.Show(string.Format("{0} is Cloned to {1}", name, path));
            };
        }
Exemplo n.º 10
0
        private void OnDocumentCommit(object sender, EventArgs e)
        {
            if (getSignature() == null)
            {
                MessageBox.Show(string.Format("Please tell git who you are!"));
                DoubleInput conform = new DoubleInput();
                conform.Show(ActiveCanvas.FindForm());
                return;
            }
            if (ActiveCanvas.Document == null)
            {
                return;
            }
            bool isModified = ActiveCanvas.Document.IsModified;

            if (isModified)
            {
                MessageBox.Show(string.Format("Please save this document first!"));
            }
            else
            {
                string     docPath    = ActiveCanvas.Document.FilePath;
                CommitForm commitForm = new CommitForm(docPath);
                try
                {
                    using (var repo = new Repository(getWorkDir(docPath)))
                    {
                        if (!repo.RetrieveStatus().IsDirty)
                        {
                            MessageBox.Show("Nothing To Commit !");
                        }
                        else
                        {
                            commitForm.Show(ActiveCanvas.FindForm());
                        }
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 11
0
 public void SetCanvas(ActiveCanvas activeCanvas) => _branchTypeBaseClass.SetCanvas(activeCanvas);