コード例 #1
0
        public static void Unityd()
        {
            FileSystem fs = new FileSystem();

            string directory = $@"{fs.RootDirectory}\Screenshots\";

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            string filename = string.Format("{0} by {1} - {2}", G.Sys.GameManager_.Level_.Name_, G.Sys.GameManager_.LevelSettings_.LevelCreatorName_, System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));

            foreach (char c in System.IO.Path.GetInvalidFileNameChars())
            {
                filename = filename.Replace(c, ' ');
            }

            bool filealreadyexists = File.Exists($@"{directory}\{filename}.png");

            UnityEngine.Application.CaptureScreenshot($@"{directory}\{filename}.png");

            if (!filealreadyexists)
            {
            }
            string title       = "Unityd - " + G.Sys.GameManager_.LevelSettings_.LevelName_;
            string description = "Screenshot saved.";

            NotificationBox.Notification n = new NotificationBox.Notification(title, description, NotificationBox.NotificationType.Car, 6f);
            NotificationBox.Show(n, false);
        }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: KaramanisWeb/TestMeApp
        public static void notifyThem(NotificationBox ntfbox, string msg, NotificationBox.Type ntype)
        {
            InvokeMe(ntfbox, () =>
            {
                ntfbox.Text             = msg;
                ntfbox.NotificationType = ntype;
                ntfbox.Visible          = true;
                ntfbox.Show();
                switch (ntype)
                {
                case NotificationBox.Type.Success:
                    ntfbox.Image = TestME.Properties.Resources.tick;
                    break;

                case NotificationBox.Type.Error:
                    ntfbox.Image = TestME.Properties.Resources.error;
                    break;

                case NotificationBox.Type.Warning:
                    ntfbox.Image = TestME.Properties.Resources.warning;
                    break;

                case NotificationBox.Type.Notice:
                    ntfbox.Image = TestME.Properties.Resources.notice;
                    break;

                case NotificationBox.Type.Other:
                    ntfbox.Image = TestME.Properties.Resources.star;
                    break;
                }
            });
        }
コード例 #3
0
 private void ApplicationBarSavePicture_Click(object sender, EventArgs e)
 {
     NotificationBox.Show(
         "Save picture",
         "Where would you like to save the picture?",
         SaveToPicturesHub,
         SaveToLocalStorage);
 }
コード例 #4
0
        private void WithdrawOrDepositFromAccount(Account account, decimal sum, bool withdraw)
        {
            WalletError error;

            try
            {
                var walletResulted = withdraw
                                         ? TradeSharpWalletManager.Instance.proxy.TransferToWallet(
                    CurrentProtectedContext.Instance.MakeProtectedContext(),
                    AccountStatus.Instance.Login,
                    account.ID, sum, out error)
                                         : TradeSharpWalletManager.Instance.proxy.TransferToTradingAccount(
                    CurrentProtectedContext.Instance.MakeProtectedContext(),
                    AccountStatus.Instance.Login,
                    account.ID, sum, out error);
                if (error == WalletError.OK)
                {
                    if (UserSettings.Instance.GetAccountEventAction(AccountEventCode.WalletModified) !=
                        AccountEventAction.DoNothing)
                    {
                        var deltaMoney = walletResulted.Balance - walletExplicitDetail.wallet.Balance;
                        var msg        = string.Format("Баланс кошелька изменен: {0} {1} {2}",
                                                       deltaMoney >= 0 ? "внесено" : "выведено",
                                                       deltaMoney.ToStringUniformMoneyFormat(true),
                                                       walletResulted.Currency);

                        bool repeatNotification;
                        NotificationBox.Show(msg, "Операция выполнена", out repeatNotification);

                        if (!repeatNotification)
                        {
                            UserSettings.Instance.SwitchAccountEventAction(AccountEventCode.WalletModified);
                            UserSettings.Instance.SaveSettings();
                        }
                    }

                    // обновить данные кошелька и счетов
                    InitiateAsynchLoad();
                    return;
                }
            }
            catch
            {
                error = WalletError.CommonError;
            }

            if (error != WalletError.OK)
            {
                var errorString = EnumFriendlyName <WalletError> .GetString(error);

                Logger.ErrorFormat("WithdrawFromAccount() error: {0}", errorString);
                MessageBox.Show("Ошибка выполнения операции:\n" + errorString,
                                "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //return;
            }
        }
コード例 #5
0
 private void InitializeCommands()
 {
     CancelCommand = new RelayCommand(() =>
     {
         if (NotificationBox.Show(Resources.Common_CancelDialogTitle,
                                  Resources.Common_CancelDialogBody, MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             MainViewModel.ShouldCancel = true;
             CommandManager.InvalidateRequerySuggested();
         }
     }, () => !MainViewModel.ShouldCancel);
 }
コード例 #6
0
        private void InitializeCommands()
        {
            CancelCommand = new RelayCommand(() =>
            {
                if (NotificationBox.Show(Resources.Common_ExitMessage_Title, Resources.Common_ExitMessage_Text,
                                         MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    BootstrapperApp.BootstrapperDispatcher.InvokeShutdown();
                }
            });

            UninstallCommand = new RelayCommand(Uninstall);
        }
コード例 #7
0
        private void InitializeCommands()
        {
            BrowseCommand = new RelayCommand(OpenFileDialog);
            CancelCommand = new RelayCommand(() =>
            {
                if (NotificationBox.Show(Resources.Common_ExitMessage_Title, Resources.Common_ExitMessage_Text,
                                         MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    BootstrapperApp.BootstrapperDispatcher.InvokeShutdown();
                }
            });

            InstallCommand = new RelayCommand(Install, () => !string.IsNullOrWhiteSpace(InstallationPath));
        }
コード例 #8
0
        /// <summary>
        /// сообщить о возникшем гэпе - предложить закачать котировки или же
        /// закачать их автоматом
        /// </summary>
        private void ReportOnGapFound(DateTime startOfGap)
        {
            // определить, не пришелся ли "гэп" на выходные
            var gapInterval = new DateSpan(startOfGap, DateTime.Now);
            var miniHoles   = DaysOff.Instance.GetIntersected(gapInterval);
            var gaps        = QuoteCacheManager.SubtractPeriods(gapInterval, miniHoles);

            if (gaps == null || gaps.Count == 0)
            {
                return;
            }
            var sumMinutes = gaps.Sum(g => (g.end - g.start).TotalMinutes);

            if (sumMinutes < MinutesOfGapInQuoteStream)
            {
                return;
            }

            // вывести уведомление
            var msg = gaps.Count == 1
                          ? string.Format("заполнить гэп ({0} минут)", (int)sumMinutes)
                          : string.Format("заполнить гэпы ({0} минут суммарно)", (int)sumMinutes);

            AddUrlToStatusPanelSafe(DateTime.Now, msg, LinkTargetFillGaps);
            var action = UserSettings.Instance.GetAccountEventAction(AccountEventCode.GapFound);

            if (action == AccountEventAction.StatusPanelOnly || action == AccountEventAction.DoNothing)
            {
                return;
            }

            // показать желтое окошко
            var repeatNotification = false;
            var shouldFill         = !UserSettings.Instance.ConfirmGapFilling ||
                                     (NotificationBox.Show(msg + Environment.NewLine + "Заполнить сейчас?", "Обнаружен гэп",
                                                           MessageBoxButtons.YesNo, out repeatNotification) == DialogResult.Yes);

            if (UserSettings.Instance.ConfirmGapFilling != repeatNotification)
            {
                UserSettings.Instance.ConfirmGapFilling = repeatNotification;
                UserSettings.Instance.SaveSettings();
            }
            if (!shouldFill)
            {
                return;
            }
            Invoke(new Action <string>(FillGapAfterReport), LinkTargetFillGaps);
        }
コード例 #9
0
        private void InitializeCommands()
        {
            CancelCommand = new RelayCommand(() =>
            {
                if (NotificationBox.Show(Resources.Common_CancelDialogTitle,
                                         Resources.Common_CancelDialogBody, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Log(LogLevel.Standard, $"User has cancelled {MainViewModel.LaunchAction} process.");

                    ActionText        = Resources.Common_ProgressView_Cancelling;
                    ActionDescription = Resources.Common_ProgressView_CancellingDescription;

                    MainViewModel.ShouldCancel = true;
                    CommandManager.InvalidateRequerySuggested();
                }
            }, () => !MainViewModel.ShouldCancel);
        }
コード例 #10
0
 //Gets client tag from client then updates list item
 private void AddClientTag(int ConnectionId, string Tag)
 {
     for (int n = lbConnectedClients.Items.Count - 1; n >= 0; --n)
     {
         ListViewItem LVI = lbConnectedClients.Items[n];
         if (LVI.SubItems[0].Text.Contains(ConnectionId.ToString()))
         {
             lbConnectedClients.Items[n].SubItems[2].Text = Tag;
         }
         if (Settings.GetNotifyValue())
         {
             NB           = new NotificationBox();
             NB.ClientTag = Tag;
             NB.IP        = MainServer.GetClientAddress(ConnectionId);
             NB.Show();
         }
     }
 }
コード例 #11
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (ViewModel.BurnInstallationState != BurnInstallationState.Applying &&
                (ViewModel.PageViewModel != null && (ViewModel.PageViewModel.PageType == PageType.FinishPage ||
                                                     ViewModel.PageViewModel.PageType == PageType.FinishErrorPage)))
            {
                return;
            }

            if (ViewModel.ShouldCancel)
            {
                NotificationBox.Show(Properties.Resources.Common_CancelAlreadyInProgressMessageBoxTitle,
                                     Properties.Resources.Common_CancelAlreadyInProgressMessageBoxBody, MessageBoxButtons.OK);

                e.Cancel = true;

                return;
            }
        }
コード例 #12
0
        public static void ShowResults()
        {
            if (timer is null || timer == null || notificationcount > 0)
            {
                Stop();
                return;
            }
            NotificationBox.Notification n = new NotificationBox.Notification("Run results", $"{Timer.GetTime(false, 3, true)}", NotificationBox.NotificationType.Campaign, "MeetYourRival");
            NotificationBox.Show(n, true);
            notificationcount += 1;

            Stop();
            return;

            string message = $"Run time: {Timer.GetTime()}";

            G.Sys.MenuPanelManager_.ShowYesNo(message, "SEEDRUN MODE", () => {
                Console.WriteLine("TEST");
            });
        }
コード例 #13
0
        //[Test]
        #endif
        public void ShowMessage()
        {
            const string testText = "Основной текст сообщения Основной текст сообщения Основной текст " +
                                    "сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения Основной " +
                                    "текст сообщения Основной текст сообщения Основной текст сообщения";

            bool repeatNotification;
            var  res1 = NotificationBox.Show(testText, "Заголовок", out repeatNotification);
            var  res2 = NotificationBox.Show(testText, "Заголовок", MessageBoxIcon.Error, out repeatNotification);
            var  res3 = NotificationBox.Show(testText, "Заголовок", MessageBoxButtons.OKCancel, out repeatNotification);
            var  res4 = NotificationBox.Show(testText, "Заголовок", MessageBoxButtons.AbortRetryIgnore, out repeatNotification);
            var  res5 = NotificationBox.Show(testText, "Заголовок", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning, out repeatNotification);
        }
コード例 #14
0
 private void AskToPin()
 {
     NotificationBox.Show("Important", "Please pin your application to Start Screen so this application can work properly.");
 }
コード例 #15
0
ファイル: Utilities.cs プロジェクト: Hli4S/TestMeApp
 public static void notifyThem(NotificationBox ntfbox,string msg,NotificationBox.Type ntype)
 {
     InvokeMe(ntfbox, () =>
     {
         ntfbox.Text = msg;
         ntfbox.NotificationType = ntype;
         ntfbox.Visible = true;
         ntfbox.Show();
         switch (ntype)
         {
             case NotificationBox.Type.Success:
                 ntfbox.Image = TestME.Properties.Resources.tick;
                 break;
             case NotificationBox.Type.Error:
                 ntfbox.Image = TestME.Properties.Resources.error;
                 break;
             case NotificationBox.Type.Warning:
                 ntfbox.Image = TestME.Properties.Resources.warning;
                 break;
             case NotificationBox.Type.Notice:
                 ntfbox.Image = TestME.Properties.Resources.notice;
                 break;
             case NotificationBox.Type.Other:
                 ntfbox.Image = TestME.Properties.Resources.star;
                 break;
         }
     });
 }
コード例 #16
0
        private void Bootstrapper_DetectComplete(object sender, DetectCompleteEventArgs e)
        {
            Log(LogLevel.Standard, $"Detection complete. VersionStatus: {VersionStatus}");

            if (VersionStatus == VersionStatus.Current)
            {
                BurnInstallationState = BurnInstallationState.Failed;
                Log(LogLevel.Standard, "An attempt to reinstall the application was made.");

                if (!IsInteractive)
                {
                    if (Bootstrapper.Command.Action == LaunchAction.Uninstall)
                    {
                        PlanAction(Bootstrapper.Command.Action);
                        return;
                    }

                    ShutDownWithCancelCode();
                }
            }

            if (VersionStatus == VersionStatus.NewerAlreadyInstalled)
            {
                BurnInstallationState = BurnInstallationState.DetectedNewer;
                Log(LogLevel.Standard, "An attempt to downgrade the application was made.");

                if (IsInteractive)
                {
                    BootstrapperApp.BootstrapperDispatcher.Invoke((Action) delegate
                    {
                        NotificationBox.Show(string.Format(Resources.Common_NewerVersionInstalledTitle, Bootstrapper.BundleName),
                                             string.Format(Resources.Common_NewerVersionInstalledMessage, Bootstrapper.BundleName),
                                             MessageBoxButtons.OK);
                    });
                }

                ShutDownWithCancelCode();
            }
            else if (IsInteractive)
            {
                if (IsInstalled)
                {
                    if (BootstrapperUpdateState == UpdateState.Available)
                    {
                        // update page
                        NavigateToPage(PageType.InstallPage);
                    }
                    else
                    {
                        NavigateToPage(PageType.MaintenancePage);
                    }
                }
                else
                {
                    NavigateToPage(PageType.InstallPage);
                }
            }
            else
            {
                PlanAction(Bootstrapper.Command.Action);
            }
        }
コード例 #17
0
        private void GridPaymentOnUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            var gridPayment = sender as FastGrid.FastGrid;

            if (gridPayment == null)
            {
                return;
            }
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            var transfer = (Transfer)gridPayment.rows[rowIndex].ValueObject;

            // показать подсказку по платежу - перевод на счет, платеж за услугу...
            // if (col.PropertyName == "Comment")
            if (col.PropertyName == transfer.Property(t => t.Comment))
            {
                // подписка?
                if (transfer.Subscription.HasValue)
                {
                    new ServiceDetailForm(transfer.Subscription.Value).ShowDialog();
                    return;
                }
                // перевод на торг. счет?
                // платеж в пользу кошелька?
                if (transfer.BalanceChange.HasValue || transfer.RefWallet.HasValue)
                {
                    BalanceChange bc = null;
                    PlatformUser  us = null;
                    try
                    {
                        TradeSharpWalletManager.Instance.proxy.GetTransferExtendedInfo(
                            CurrentProtectedContext.Instance.MakeProtectedContext(), transfer.Id, out bc, out us);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("GetTransferExtendedInfo()", ex);
                    }
                    if (bc == null && us == null)
                    {
                        return;
                    }
                    if (UserSettings.Instance.GetAccountEventAction(AccountEventCode.WalletModified) == AccountEventAction.DoNothing)
                    {
                        return;
                    }

                    var text = bc != null
                        ? string.Format("{0} счета {1}, {2} {3}",
                                        BalanceChange.GetSign(bc.ChangeType) > 0? "Пополнение" : "Списание со",
                                        bc.AccountID,
                                        bc.AmountDepo.ToStringUniformMoneyFormat(),
                                        walletCurrency /*bc.Currency*/)
                        : string.Format("Платеж на кошелек пользователя, {0}", us.MakeFullName());

                    bool repeatNotification;
                    NotificationBox.Show(text, "Операция выполнена", out repeatNotification);

                    if (!repeatNotification)
                    {
                        UserSettings.Instance.SwitchAccountEventAction(AccountEventCode.WalletModified);
                        UserSettings.Instance.SaveSettings();
                    }
                }
            }
        }
コード例 #18
0
 private static void LevelStats()
 {
     NotificationBox.Notification n = new NotificationBox.Notification($"{G.Sys.GameManager_.LevelName_}", $"{Timer.GetTime(true, 3)}", NotificationBox.NotificationType.Campaign, "WorldTraveller");
     NotificationBox.Show(n, false);
 }
コード例 #19
0
        private void Bootstrapper_Error(object sender, ErrorEventArgs e)
        {
            e.Result = Result.Restart;

            Log(LogLevel.Standard, $"Bootstrapper has called {nameof(this.Bootstrapper_Error)}");

            lock (this)
            {
                try
                {
                    Log(LogLevel.Error, $"Bootstrapper received error code {e.ErrorCode}: {e.ErrorMessage}");

                    if (ShouldCancel)
                    {
                        e.Result = Result.Cancel;
                        return;
                    }

                    if (BurnInstallationState == BurnInstallationState.Applying && e.ErrorCode == 1223)
                    {
                        return;
                    }

                    ErrorMessage = e.ErrorMessage;

                    if (!IsInteractive)
                    {
                        return;
                    }

                    var messageBoxButtonValue = e.UIHint & 0xF;

                    MessageBoxButtons messageBoxButton;

                    if (Enum.GetValues(typeof(MessageBoxButtons)).OfType <int>().Contains(messageBoxButtonValue))
                    {
                        messageBoxButton = (MessageBoxButtons)messageBoxButtonValue;
                    }
                    else
                    {
                        messageBoxButton = MessageBoxButtons.OK;
                    }

                    var result = DialogResult.None;

                    BootstrapperApp.BootstrapperDispatcher.Invoke(
                        (Action)
                        delegate
                    {
                        result = NotificationBox.Show(string.Format(Resources.Common_InstallErrorMessageTitle, Bootstrapper.BundleName),
                                                      e.ErrorMessage, messageBoxButton);
                    });

                    if (messageBoxButtonValue == (int)messageBoxButton)
                    {
                        e.Result = (Result)result;
                    }
                }
                finally
                {
                    Log(LogLevel.Error, $"Bootstrapper handled error {e.ErrorCode}: {e.ErrorMessage}");
                }
            }
        }