Ejemplo n.º 1
0
    void billingNotSupportedEvent(string error)
    {
        Debug.Log("billingNotSupportedEvent: " + error);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: billingNotSupportedEvent", error);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// 关或者不关,选择权就在那儿!
        /// </summary>
        /// <param name="abortAction">中止行为操作</param>
        /// <param name="showMessage">显示话术</param>
        /// <param name="processName">进程名称</param>
        private void ChooseByYourSelf(Action <string> abortAction, ShowMessages showMessage, string processName)
        {
            DialogResult dialogResult = MessageBox.Show(showMessage.ToString(), "战胜自己!你可以的!", MessageBoxButtons.AbortRetryIgnore);

            if (dialogResult == DialogResult.Abort)
            {
                abortAction(processName);
                MessageBox.Show(ShowMessages.成功的抵制了诱惑.ToString() + "!");
            }
            else if (dialogResult == DialogResult.Ignore)
            {
                if ((int)showMessage < 2)
                {
                    ChooseByYourSelf(abortAction, (ShowMessages)((int)showMessage + 1), processName);
                }
                else
                {
                    MessageBox.Show(ShowMessages.你太让我失望了.ToString());
                }
            }
            else if (dialogResult == DialogResult.Retry)
            {
                ChooseByYourSelf(abortAction, showMessage, processName);
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CustomPlugin cp = new CustomPlugin();

            cp.Initialize();

            GMailIntegration mail = new GMailIntegration(cp.GmailUsername, cp.GmailPassword);

            Console.WriteLine("New mails: {0}", mail.NewMessagesCount);

            for (int i = 0; i < mail.Entries.Count; ++i)
            {
                Console.WriteLine("{0} {1} {2}", mail.Entries[i].FromEmail, mail.Entries[i].Id, mail.Entries[i].Link);
            }

            try
            {
                ShowMessages showMessagesForm = new ShowMessages(mail.Entries);
                showMessagesForm.Show();
            }
            catch
            {
                ShowMessages showMessagesForm = new ShowMessages(false);
                showMessagesForm.Show();
            }

            Console.ReadLine();
        }
Ejemplo n.º 4
0
    void queryInventoryFailedEvent(string error)
    {
        Debug.Log("queryInventoryFailedEvent: " + error);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: queryInventoryFailedEvent", error);
    }
Ejemplo n.º 5
0
    public static void onVerificationError(string _ret)
    {
        Debug.Log("Verification failed: " + _ret);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: verification failed. ErrorInfo: ", _ret);
    }
Ejemplo n.º 6
0
    void purchaseFailedEvent(string error)
    {
        Debug.Log("purchaseFailedEvent: " + error);
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error Purchasing", "Error purchasing");
    }
 /// <summary>
 /// Метод предлагает сделать дополнительные изменения программы.
 /// </summary>
 public virtual void MoreChanges()
 {
     ShowMessages.ShowMessage();
     SetProgram();
     if (CheckInput.CheckChanges())
     {
         SetOfProgramChanges();
     }
 }
Ejemplo n.º 8
0
        public void RealizarTravessia(ElementoBase motorista, ElementoBase passageiro = null)
        {
            dupla = MontarDupla(motorista, passageiro);
            var deslocamento = MontarDeslocamento();

            if (Validar())
            {
                Mensagens.Add(new SmartFortwo().Travel(deslocamento));
            }
            ShowMessages.Invoke(Mensagens, new EventArgs());
            LimparMensagens();
        }
Ejemplo n.º 9
0
    public static void onVerificationSucceeded(object _ret)
    {
        Dictionary <string, object> resp = (Dictionary <string, object>)_ret;

        if (resp != null && resp.ContainsKey("code"))
        {
            int code = (int)(System.Int64)resp["code"];
            switch (code)
            {
            case 0:
                Debug.Log("Verification succeeded");
                InAppPersistenceManager.instance.SetPurchaseInfo(productID, InAppPersistenceManager.InAppPersistenceState.consume_pending);
                BillingManager.instance.HandlePurchase(resp, productID);
                break;

            case -10: { // Purchase ID not matching the purchase token
                Debug.Log("Verification failed: PurchaseID incorrect. Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Purchase Id incorrect");
            }
            break;

            case -14: { // Purchase duplicated
                Debug.Log("Verification failed: PurchaseID duplicated. Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Purchase Id duplicated");
            }
            break;

            case -29: { // Purchase TOKEN not valid (doesn't match the ProductID)
                Debug.Log("Verification failed: Purchase Token incorrect. Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Purchase Token incorrect");
            }
            break;

            default: {
                // 400 -> Wrong Purchase Token
                // 404 -> Purchase Token doesn't match the ProductId
                Debug.Log("Verification failed: Generic Error Code: " + code);
                ShowMessages sm = new ShowMessages();
                sm.ShowMessageWindow("Error: purchase failed", "Generic Purchase Error");
            }
            break;
            }
        }
    }
Ejemplo n.º 10
0
    public void init(string key, string[] skus)
    {
#if UNITY_ANDROID
        GoogleIAB.init(key);
        //copiedSkus = new string[skus.Length];
        copiedSkus = skus;
        //GoogleIAB.queryInventory(skus);
#elif UNITY_IPHONE
        bool canMakePayments = StoreKitBinding.canMakePayments();
        if (canMakePayments)
        {
            StoreKitBinding.requestProductData(skus);
        }
        else
        {
            ShowMessages sm = new ShowMessages();
            sm.ShowMessageWindow("ERROR ACCESSING APPLE STORE", "You can't connect to Apple Store, network error detected");
        }
#endif
    }
Ejemplo n.º 11
0
    void purchaseFailedEvent(string error)
    {
        Debug.Log("purchaseFailedEvent: " + error);
        string response = "response: ";
        int    size     = error.LastIndexOf(":") - (error.IndexOf(response) + response.Length);

        ShowMessages sm = new ShowMessages();

        switch (error.Substring(error.IndexOf(response) + response.Length, size))
        {
        case "-1005":
            sm.ShowMessageWindow("Error Purchasing", "USER HAS CANCELLED THIS PURCHASE");
            //InAppPersistenceManager.instance.ErasePurchaseInfo(ProductID);
            break;

        case "7":
            sm.ShowMessageWindow("Error Purchasing", "YOU OWN THIS OBJECT!!");
            //InAppPersistenceManager.instance.ErasePurchaseInfo(ProductID);
            break;
        }
    }
Ejemplo n.º 12
0
        private void ShowGetMessage(string sPICK_TASK, TagDetailInfo dti, int iFlag, List <InventoryOutLogDetailInfo> outLogList, string sMessage, DataRow row, string sMATNR)
        {
            if (this.InvokeRequired)
            {
                ShowMessages show = new ShowMessages(ShowGetMessage);
                this.BeginInvoke(show, sPICK_TASK, dti, iFlag, outLogList, sMessage, row, sMATNR);
            }
            else
            {
                grid.Rows.Add(sMATNR, sPICK_TASK, row[1].ToString(), row[3].ToString(), row[2].ToString(),


                              iFlag == 0 ? 0 : outLogList.FindAll(i => i.PICK_TASK == sPICK_TASK && i.PRODUCTNO == sMATNR).Sum(i => i.QTY),
                              dti.IsAddEpc ? 0 : (1 + epcList.FindAll(i => i.IsADD == 0 && i.ZSATNR == row[1].ToString() && i.ZCOLSN == row[3].ToString() && i.ZSIZTX == row[2].ToString()).Count),
                              (dti.IsAddEpc ? "0" : "1" + (iFlag == 0 ? sMessage : "")),

                              iFlag == 0 ? 0 : outLogList.FindAll(i => i.PICK_TASK == sPICK_TASK && i.PRODUCTNO == sMATNR).Sum(i => i.QTY_ADD),
                              !dti.IsAddEpc ? 0 : (1 + epcList.FindAll(i => i.IsADD == 1 && i.ZSATNR == row[1].ToString() && i.ZCOLSN == row[3].ToString() && i.ZSIZTX == row[2].ToString()).Count),
                              (!dti.IsAddEpc ? "0" : "1" + (iFlag == 0 ? sMessage : "")));
            }
        }
Ejemplo n.º 13
0
    public static void onVerificationError(string _ret)
    {
        ShowMessages sm = new ShowMessages();

        sm.ShowMessageWindow("Error: confirmation failed. ErrorInfo: ", _ret);
    }
Ejemplo n.º 14
0
        /// <summary>
        /// Convert message to XML.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TranslateBtn_Click(object sender, EventArgs e)
        {
            if (MessagePduTB.ReadOnly)
            {
                StatusLbl.Text = "Cancelling translate.";
                CancelTranslate.Set();
                return;
            }
            TranslateBtn.Checked  = true;
            MessagePduTB.ReadOnly = true;
            Follow       follow = (Follow)FollowmessagesCb.SelectedItem;
            ShowMessages show   = (ShowMessages)ShowCb.SelectedItem;

            MessageXmlTB.Text   = null;
            ProgressBar.Visible = true;
            object selectedInterface = InterfaceCb.SelectedItem;

            UpdateSecuritySettings();
            StatusLbl.Text = "Finding frames";
            GXByteBuffer bb = new GXByteBuffer();

            bb.Set(GXDLMSTranslator.HexToBytes(RemoveComments(string.Join(Environment.NewLine, MessagePduTB.Lines))));
            System.Threading.Tasks.Task.Run(async() =>
            {
                if (translator.BlockCipherKey != null)
                {
                    OnAppendMessage("BlockCipher key: " +
                                    GXDLMSTranslator.ToHex(translator.BlockCipherKey) + Environment.NewLine, Color.Green);
                }
                if (translator.AuthenticationKey != null)
                {
                    OnAppendMessage("Authentication Key:" +
                                    GXDLMSTranslator.ToHex(translator.AuthenticationKey) + Environment.NewLine, Color.Green);
                }
                StringBuilder sb = new StringBuilder();
                Security s       = translator.Security;
                int count        = 1;
                try
                {
                    translator.Clear();
                    translator.PduOnly = PduOnlyMnu.Checked;
                    GXByteBuffer pdu   = new GXByteBuffer();
                    UpdateProgress(0, 0);
                    UpdateMaxProgress(bb.Size, 0);
                    GXDLMSTranslatorMessage frame = new GXDLMSTranslatorMessage();
                    frame.Message = bb;
                    if (selectedInterface is string)
                    {
                        frame.InterfaceType = GXDLMSTranslator.GetDlmsFraming(bb);
                        BeginInvoke((Action)(() =>
                        {
                            InterfaceCb.SelectedItem = frame.InterfaceType;
                        }));
                    }
                    else
                    {
                        frame.InterfaceType = (InterfaceType)selectedInterface;
                    }
                    string last       = "";
                    int clientAddress = 0, serverAddress = 0;
                    while (translator.FindNextFrame(frame, pdu, clientAddress, serverAddress))
                    {
                        //Translate is cancelled.
                        if (CancelTranslate.WaitOne(1))
                        {
                            UpdateMaxProgress(0, 0);
                            BeginInvoke((Action)(() =>
                            {
                                MessagePduTB.ReadOnly = false;
                                TranslateBtn.Checked = false;
                            }));
                            CancelTranslate.Reset();
                            return;
                        }
                        int start = bb.Position;
                        UpdateProgress(start, count);
                        GXDLMSTranslatorMessage msg = new GXDLMSTranslatorMessage();
                        msg.Message = bb;
                        translator.MessageToXml(msg);
                        if (follow != Follow.None)
                        {
                            if ((follow & Follow.Client) != 0 && clientAddress == 0)
                            {
                                clientAddress = msg.SourceAddress;
                            }
                            if ((follow & Follow.Meter) != 0 && serverAddress == 0)
                            {
                                serverAddress = msg.TargetAddress;
                            }
                        }
                        //Remove duplicate messages.
                        if (RemoveDuplicatesMnu.Checked)
                        {
                            if (last == msg.Xml)
                            {
                                continue;
                            }
                        }
                        last = msg.Xml;
                        if (msg.Command == Command.Aarq)
                        {
                            if (msg.SystemTitle != null && msg.SystemTitle.Length == 8)
                            {
                                if (UpdateSystemTitle(this, "Current System title \"{0}\" is different in the parsed \"{1}\". Do you want to start using parsed one?",
                                                      msg.SystemTitle, translator.SystemTitle))
                                {
                                    translator.SystemTitle = msg.SystemTitle;
                                    BeginInvoke((Action)(() =>
                                    {
                                        Ciphering.SystemTitle = msg.SystemTitle;
                                    }));
                                }
                            }
                            if (msg.DedicatedKey != null && msg.DedicatedKey.Length == 16)
                            {
                                if (UpdateSystemTitle(this, "Current dedicated key \"{0}\" is different in the parsed \"{1}\". Do you want to start using parsed one?",
                                                      msg.DedicatedKey, translator.DedicatedKey))
                                {
                                    translator.DedicatedKey = msg.DedicatedKey;
                                    BeginInvoke((Action)(() =>
                                    {
                                        Ciphering.DedicatedKey = msg.DedicatedKey;
                                    }));
                                }
                            }
                        }
                        if (msg.Command == Command.Aare && msg.SystemTitle != null && msg.SystemTitle.Length == 8)
                        {
                            if (UpdateSystemTitle(this, "Current Server System title \"{0}\" is different in the parsed \"{1}\". Do you want to start using parsed one?",
                                                  msg.SystemTitle, translator.ServerSystemTitle))
                            {
                                translator.ServerSystemTitle = msg.SystemTitle;
                                BeginInvoke((Action)(() =>
                                {
                                    Ciphering.ServerSystemTitle = msg.SystemTitle;
                                }));
                            }
                        }
                        if (show != ShowMessages.All)
                        {
                            switch (msg.Command)
                            {
                            case Command.None:
                                break;

                            case Command.InitiateRequest:
                            case Command.ReadRequest:
                            case Command.WriteRequest:
                            case Command.GetRequest:
                            case Command.SetRequest:
                            case Command.MethodRequest:
                            case Command.Snrm:
                            case Command.Aarq:
                            case Command.ReleaseRequest:
                            case Command.DisconnectRequest:
                            case Command.AccessRequest:
                            case Command.GloGetRequest:
                            case Command.GloSetRequest:
                            case Command.GloMethodRequest:
                            case Command.GloInitiateRequest:
                            case Command.GloReadRequest:
                            case Command.GloWriteRequest:
                            case Command.DedInitiateRequest:
                            case Command.DedReadRequest:
                            case Command.DedWriteRequest:
                            case Command.DedGetRequest:
                            case Command.DedSetRequest:
                            case Command.DedMethodRequest:
                            case Command.GatewayRequest:
                                if (show == ShowMessages.Received)
                                {
                                    continue;
                                }
                                break;

                            case Command.InitiateResponse:
                            case Command.ReadResponse:
                            case Command.WriteResponse:
                            case Command.GetResponse:
                            case Command.SetResponse:
                            case Command.MethodResponse:
                            case Command.Ua:
                            case Command.Aare:
                            case Command.ReleaseResponse:
                            case Command.AccessResponse:
                            case Command.GloGetResponse:
                            case Command.GloSetResponse:
                            case Command.GloMethodResponse:
                            case Command.GloInitiateResponse:
                            case Command.GloReadResponse:
                            case Command.GloWriteResponse:
                            case Command.DedInitiateResponse:
                            case Command.DedReadResponse:
                            case Command.DedWriteResponse:
                            case Command.DedGetResponse:
                            case Command.DedSetResponse:
                            case Command.DedMethodResponse:
                            case Command.GatewayResponse:
                                if (show == ShowMessages.Sent)
                                {
                                    continue;
                                }
                                break;

                            case Command.DisconnectMode:
                            case Command.UnacceptableFrame:
                            case Command.ConfirmedServiceError:
                            case Command.ExceptionResponse:
                            case Command.GeneralBlockTransfer:
                            case Command.DataNotification:
                            case Command.GloEventNotification:
                            case Command.GloConfirmedServiceError:
                            case Command.GeneralGloCiphering:
                            case Command.GeneralDedCiphering:
                            case Command.GeneralCiphering:
                            case Command.GeneralSigning:
                            case Command.InformationReport:
                            case Command.EventNotification:
                            case Command.DedConfirmedServiceError:
                            case Command.DedUnconfirmedWriteRequest:
                            case Command.DedInformationReport:
                            case Command.DedEventNotification:
                                break;
                            }
                        }
                        if (Properties.Settings.Default.TranslatorFrame)
                        {
                            if (Properties.Settings.Default.FrameNumber)
                            {
                                sb.Append(count + ": ");
                            }
                            sb.AppendLine(bb.ToHex(true, start, bb.Position - start));
                        }
                        if (Properties.Settings.Default.TranslatorXml)
                        {
                            sb.Append(msg.Xml);
                        }
                        if (msg.Exception != null)
                        {
                            ++count;
                            OnAppendMessage(sb.ToString(), Color.Red);
                        }
                        else if (show != ShowMessages.Failed)
                        {
                            ++count;
                            OnAppendMessage(sb.ToString());
                        }
                        sb.Clear();
                        pdu.Clear();
                    }
                    OnAppendMessage(sb.ToString());
                    translator.Security = s;
                    //Update UI.
                    await System.Threading.Tasks.Task.Delay(1);
                }
                catch (Exception ex)
                {
                    translator.Security = s;
                    OnAppendMessage(sb.ToString());
                    OnAppendMessage(Environment.NewLine);
                    OnAppendMessage(bb.RemainingHexString(true));
                    MessageBox.Show(ex.Message);
                }
                //Count starts from 1.
                UpdateMaxProgress(0, count - 1);
                BeginInvoke((Action)(() =>
                {
                    MessagePduTB.ReadOnly = false;
                    TranslateBtn.Checked = false;
                }));
            });
        }
Ejemplo n.º 15
0
 /// <nodoc/>
 internal void ShowMessage(JToken @params)
 {
     ShowMessages.Add(@params.ToObject <ShowMessageParams>());
 }
        /// <summary>
        /// Метод предлагает сделать изменения выбранной программы.
        /// </summary>
        public virtual void SetOfProgramChanges()
        {
            ShowMessages.ShowProgramChanges();
            int selectionChanges = SetValues.ListOfChanges();

            switch (selectionChanges)
            {
            case 1:
                ShowMessages.ShowTemperatureChanges();
                int selectionTemp = SetValues.ListOfTemperatureChanges();

                switch (selectionTemp)
                {
                case 1:
                    _temperature = 0;
                    MoreChanges();
                    break;

                case 2:
                    _temperature = 30;
                    MoreChanges();
                    break;

                case 3:
                    _temperature = 40;
                    MoreChanges();
                    break;

                case 4:
                    _temperature = 60;
                    MoreChanges();
                    break;

                case 5:
                    _temperature = 95;
                    MoreChanges();
                    break;
                }
                break;

            case 2:
                ShowMessages.ShowRinseChanges();
                int selectionRinse = SetValues.ListOfRinseChanges();

                switch (selectionRinse)
                {
                case 1:
                    _numbRinses = 1;
                    MoreChanges();
                    break;

                case 2:
                    _numbRinses = 2;
                    MoreChanges();
                    break;

                case 3:
                    _numbRinses = 3;
                    MoreChanges();
                    break;
                }
                break;

            case 3:
                ShowMessages.ShowSpinningChanges();
                int selectionSpinning = SetValues.ListOfSpinningChanges();

                switch (selectionSpinning)
                {
                case 1:
                    _spinning = 0;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("*Отжим отключен!");
                    Console.WriteLine("---------------");
                    Console.ResetColor();
                    MoreChanges();
                    break;

                case 2:
                    _spinning = 400;
                    MoreChanges();
                    break;

                case 3:
                    _spinning = 600;
                    MoreChanges();
                    break;

                case 4:
                    _spinning = 800;
                    MoreChanges();
                    break;

                case 5:
                    _spinning = 1000;
                    MoreChanges();
                    break;

                case 6:
                    _spinning = 1200;
                    MoreChanges();
                    break;
                }
                break;

            case 4:
                ShowMessages.ShowEcobubleChanges();
                int selectionEcobuble = SetValues.ListOfEcobubleChanges();

                switch (selectionEcobuble)
                {
                case 1:
                    _ecobuble = "Включен";
                    MoreChanges();
                    break;

                case 2:
                    _ecobuble = "Выключен";
                    MoreChanges();
                    break;
                }
                break;

            case 5:
                Console.Clear();
                ShowMessages.ListOfPrograms();
                SetValues.SelectionConditionsProgram();

                break;

            case 0:
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Стирка началась без изменений программы...");
                Console.ResetColor();
                break;
            }
        }
Ejemplo n.º 17
0
        // Open new Show Messages window
        private void ShowMessagesBtn_Click(object sender, RoutedEventArgs e)
        {
            ShowMessages showMessagesWindow = new ShowMessages();

            showMessagesWindow.Show();
        }
Ejemplo n.º 18
0
        public override void SetOfProgramChanges()
        {
            ShowMessages.ShowRinsePlusSpinCanges();
            int selectionChanges = SetValues.ListOfRinsePlusSpinWash();

            switch (selectionChanges)
            {
            case 1:
                ShowMessages.ShowRinseChanges();
                int selectionRinse = SetValues.ListOfRinseChanges();

                switch (selectionRinse)
                {
                case 1:
                    _numbRinses = 1;
                    MoreChanges();
                    break;

                case 2:
                    _numbRinses = 2;
                    MoreChanges();
                    break;

                case 3:
                    _numbRinses = 3;
                    MoreChanges();
                    break;
                }
                break;

            case 2:
                ShowMessages.ShowSpinningChanges();
                int selectionSpinning = SetValues.ListOfSpinningChanges();

                switch (selectionSpinning)
                {
                case 1:
                    _spinning = 0;
                    MoreChanges();
                    break;

                case 2:
                    _spinning = 400;
                    MoreChanges();
                    break;

                case 3:
                    _spinning = 600;
                    MoreChanges();
                    break;

                case 4:
                    _spinning = 800;
                    MoreChanges();
                    break;

                case 5:
                    _spinning = 1000;
                    MoreChanges();
                    break;

                case 6:
                    _spinning = 1200;
                    MoreChanges();
                    break;
                }
                break;

            case 0:
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Стирка началась без изменений программы...");
                Console.ResetColor();
                break;
            }
        }
Ejemplo n.º 19
0
 static Bank()
 {
     Accounts     = new List <Account>();
     Money        = StartMoney;
     ShowMessage += ConsoleProvider.ShowMessage;
 }