Esempio n. 1
0
 public Form_Puerto_Add(OnSuccessDelegate onSuccess)
 {
     InitializeComponent();
     _ViewModel    = new PuertoViewModel();
     _OnAddSuccess = onSuccess;
     BindViewModel();
 }
Esempio n. 2
0
 public Form_Puerto_Edit(
     OnSuccessDelegate onEditSuccess,
     int id)
 {
     InitializeComponent();
     _ViewModel = new PuertoViewModel(PuertoDAO.GetByID(id));
     BindViewModel();
     _OnEditSuccess = onEditSuccess;
 }
Esempio n. 3
0
 public Form_MantenimientoConViajes(
     MantenimientoViewModel vm,
     OnSuccessDelegate onDemorarViajesSuccess,
     OnSuccessDelegate onCancelarViajesSuccess)
 {
     InitializeComponent();
     _ViewModel = vm;
     _OnDemorarViajesSuccess  = onDemorarViajesSuccess;
     _OnCancelarViajesSuccess = onCancelarViajesSuccess;
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            OnSuccessDelegate <Artigo> onSucccessHandler = OnSuccess;
            OnSuccessDelegate <LinguagemProgramacao> onSuccessLHandler = OnSuccess;

            OnErrorDelegate onErrorHandler = OnError;

            Obter(onSucccessHandler, onErrorHandler);
            Obter(onSuccessLHandler, onErrorHandler);

            Console.ReadKey();
        }
Esempio n. 5
0
 private void ProcessEntry(PwEntry entry, OnSuccessDelegate onSuccess)
 {
     if (entry.Strings.Exists(OtpDataUtils.Key))
     {
         var data = entry.Strings.Get(OtpDataUtils.Key).ReadString();
         if (OtpDataUtils.TryParseOtpData(data, out var secret, out var pin) && pin.Length == secret.PinLength)
         {
             onSuccess(new Yaotp(secret, pin, () => DateTime.UtcNow));
         }
         else
         {
             MessageBox.Show(_host.MainWindow, string.Format(Properties.Strings.Plugin_InvalidData, OtpDataUtils.Key), Properties.Strings.Plugin_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
    /// <summary>
    /// Return the request result object.
    /// Can be the following types:
    /// - User
    /// - IList<User>
    /// 
    /// If there is something wrong, throws an exception.
    /// </summary>
    /// <param name="response">Response.</param>
    public void OnSuccess(object pResponse)
    {
        try
        {
        #if UNITY_EDITOR
            HandleResultExample(pResponse);
        #endif
            if(onSuccessCallback != null)
                onSuccessCallback (pResponse);

            onSuccessCallback = null;
        }
        catch (App42Exception e)
        {
            Debug.LogError ("App42Exception : "+ e);
        }
    }
Esempio n. 7
0
    /// <summary>
    /// Return the request result object.
    /// Can be the following types:
    /// - User
    /// - IList<User>
    ///
    /// If there is something wrong, throws an exception.
    /// </summary>
    /// <param name="response">Response.</param>
    public void OnSuccess(object pResponse)
    {
        try
        {
#if UNITY_EDITOR
            HandleResultExample(pResponse);
#endif
            if (onSuccessCallback != null)
            {
                onSuccessCallback(pResponse);
            }

            onSuccessCallback = null;
        }
        catch (App42Exception e)
        {
            Debug.LogError("App42Exception : " + e);
        }
    }
Esempio n. 8
0
        private static void Obter <T>(OnSuccessDelegate <T> onSuccess, OnErrorDelegate onError) where T : class
        {
            try
            {
                var artigos = new List <Artigo>();
                artigos.Add(new Artigo {
                    Id = 1, Descricao = "Artigo 1"
                });
                artigos.Add(new Artigo {
                    Id = 2, Descricao = "Artigo 2"
                });

                var linguagens = new List <LinguagemProgramacao>();
                linguagens.Add(new LinguagemProgramacao {
                    Nome = ".NET C#"
                });
                linguagens.Add(new LinguagemProgramacao {
                    Nome = "Python"
                });
                linguagens.Add(new LinguagemProgramacao {
                    Nome = "JAVA"
                });

                //throw new Exception("Opsss....deu erro!!");

                if (typeof(T) == typeof(Artigo))
                {
                    onSuccess((IEnumerable <T>)artigos);
                }
                if (typeof(T) == typeof(LinguagemProgramacao))
                {
                    onSuccess((IEnumerable <T>)linguagens);
                }
            }
            catch (Exception ex)
            {
                onError(new Erro($"Ocorreu um erro: { ex.Message }"));
            }
        }
Esempio n. 9
0
 public App42Response(OnSuccessDelegate pSuccessCallback, OnExceptionDelegate pExceptionCallback)
 {
     onSuccessCallback   += pSuccessCallback;
     onExceptionCallback += pExceptionCallback;
 }
 public App42Response(OnSuccessDelegate pSuccessCallback, OnExceptionDelegate pExceptionCallback)
 {
     onSuccessCallback += pSuccessCallback;
     onExceptionCallback += pExceptionCallback;
 }