Exemple #1
0
    private bool on_button_sprint_do()
    {
        button_sprint_save_image.Sensitive = false;
        if (currentPersonSession.Weight == 0)
        {
            new DialogMessage(Constants.MessageTypes.WARNING,
                              Catalog.GetString("Error, weight of the person cannot be 0"));
            return(false);
        }

        if (currentPersonSession.Height == 0)
        {
            new DialogMessage(Constants.MessageTypes.WARNING,
                              Catalog.GetString("Error, height of the person cannot be 0"));
            return(false);
        }

        if (!sprint.IsDataOk())
        {
            new DialogMessage(Constants.MessageTypes.WARNING,
                              Catalog.GetString("This data does not seem a sprint.") + "\n\n" +
                              sprint.ErrorMessage);
            return(false);
        }

        Util.FileDelete(UtilEncoder.GetSprintImage());

        image_sprint.Sensitive = false;

        bool success = sprint.CallR(
            viewport_sprint.Allocation.Width - 5,
            viewport_sprint.Allocation.Height - 5,
            currentPerson.Name);

        if (!success)
        {
            new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("This data does not seem a sprint."));
            return(false);
        }

        while (!Util.FileReadable(UtilEncoder.GetSprintImage()))
        {
            ;
        }

        image_sprint = UtilGtk.OpenImageSafe(
            UtilEncoder.GetSprintImage(),
            image_sprint);
        image_sprint.Sensitive             = true;
        button_sprint_save_image.Sensitive = true;
        return(true);
    }