コード例 #1
0
 /// <summary>
 /// Ao Alterar o diretorio
 /// </summary>
 public bool OnChangeDirEntry(ComboBox sender, VoidDelegade callback)
 {
     Console.WriteLine("Chamada OnChangeDir: {0}", sender.ActiveText);
     if (historicBuffer != sender.ActiveText &&
         string.IsNullOrEmpty(sender.ActiveText) == false)
     {
         return(EditButtonEvent(sender.ActiveText, callback));
     }
     return(false);
 }
コード例 #2
0
        /// <summary>
        /// Evento do botão Salvar
        /// </summary>
        public void SaveEvent(VoidDelegade callback)
        {
            string json = JsonController.ListToJson(GetItens());

            if (string.IsNullOrEmpty(historicBuffer) == false)
            {
                if (GetItens().Count > 0 && JsonController.SaveJson(json, historicBuffer))
                {
                    EditButtonEvent(historicBuffer, callback);
                    return;
                }
            }
            SaveAsEvent(callback);
        }
コード例 #3
0
 /// <summary>
 /// Evento Salvar Como...
 /// </summary>
 /// <param name="path">Diretorio do arquivo.</param>
 public void SaveAsEvent(VoidDelegade callback)
 {
     if (GetItens().Count > 0)
     {
         if (GTKUtils.ShowFileChooser(out string path, ".prb", "Salvar como..", "Salvar"))
         {
             string json = JsonController.ListToJson(GetItens());
             if (JsonController.SaveJson(json, path))
             {
                 Console.WriteLine(path);
                 EditButtonEvent(path, callback);
             }
         }
     }
     else
     {
         GTKUtils.ShowDilog("Não há dados a serem salvos!", MessageType.Warning, "Use a aba de Criação para gerar e editar processos!");
     }
 }
コード例 #4
0
        /// <summary>
        /// Evento do botão Editar.
        /// </summary>
        /// <param name="path">Endereçõ do novo arquivo a ser editado</param>
        public bool EditButtonEvent(string path, VoidDelegade callback)
        {
            string json = null;

            if (JsonController.OpenJson(path, ref json))
            {
                Console.WriteLine("{0} existe", path);
                creationView.LoadItens(JsonController.JsonToList <Process>(json));
                UpdateAllHistoric(path);
                callback();
                return(true);
            }

            Console.WriteLine("{0} nao existe", path);
            historicStrings.Remove(path);
            json = JsonController.ListToJson(historicStrings);
            JsonController.SaveJson(json, historicPath);
            ClearComboBox();
            return(false);
        }