コード例 #1
0
        public async Task <bool> PurchaseAppDonation()
        {
            try
            {
#if DEBUG
                var result = await CurrentAppSimulator.RequestProductPurchaseAsync("AppDonation");
#else
                var result = await CurrentApp.RequestProductPurchaseAsync("AppDonation");
#endif
                return(result.Status == ProductPurchaseStatus.Succeeded);
            }
            catch
            {
            }

            return(false);
        }
コード例 #2
0
        private void SetColumnGridView(string columnname, ref GridView ColumnGridView, string langid, string diaplay, DataTemplate datatemplate, int width)
        {
            GridViewColumn gvc = new GridViewColumn();

            gvc.Header             = CurrentApp.GetLanguageInfo(langid, diaplay);
            gvc.Width              = width;
            gvc.HeaderStringFormat = columnname;
            if (datatemplate != null)
            {
                gvc.CellTemplate = datatemplate;
            }
            else
            {
                gvc.DisplayMemberBinding = new Binding(columnname);
            }
            ColumnGridView.Columns.Add(gvc);
        }
コード例 #3
0
        public async void ComprarRemoverAnuncios()
        {
            AppSettings settings = new AppSettings();

            LicenseInformation licenseInformation = CurrentApp.LicenseInformation;

            if (!licenseInformation.ProductLicenses[IAPName].IsActive)
            {
                try
                {
                    // TENTANTIVA DE COMPRA
                    await CurrentApp.RequestProductPurchaseAsync(IAPName);

                    if (licenseInformation.ProductLicenses[IAPName].IsActive)
                    {
                        // GRAVA A COMPRA DA REMOÇÃO DOS ANÚNCIOS NAS CONFIGURAÇÕES DO APP
                        settings.UpdateBoolSettings("RemoveAds", true);

                        var dialog = new MessageDialog("Você removeu pernamenteme os anúncios");
                        await dialog.ShowAsync();
                    }
                    else
                    {
                        settings.UpdateBoolSettings("RemoveAds", false);

                        var dialog = new MessageDialog("Compra não concluida");
                        await dialog.ShowAsync();
                    }
                }
                catch
                {
                    settings.UpdateBoolSettings("RemoveAds", false);

                    var dialog = new MessageDialog("Algo deu errado durante a compra do pacote de remoção dos anúncios");
                    await dialog.ShowAsync();
                }
            }
            else
            {
                // GARANTE A GRAVAÇÃO DA COMPRA DA REMOÇÃO DOS ANÚNCIOS NAS CONFIGURAÇÕES DO APP
                settings.UpdateBoolSettings("RemoveAds", true);

                var dialog = new MessageDialog("Você já comprou o pacote de remoção de anúncios");
                await dialog.ShowAsync();
            }
        }
コード例 #4
0
        protected override void Init()
        {
            try
            {
                ListBoxLanguages.ItemsSource    = mListLangInfoItems;
                ListBoxThemes.ItemsSource       = mListThemeInfoItems;
                ListBoxModuleGroups.ItemsSource = mListModuleGroups;

                PageName  = "PageHeadNewView";
                StylePath = "UMPS1203/PageHeadNewView.xaml";

                CommandBindings.Add(new CommandBinding(AppItemCommand, AppItemCommand_Executed,
                                                       (s, ce) => ce.CanExecute = true));
                CommandBindings.Add(new CommandBinding(PageHeadCommand, PageHeadCommand_Executed,
                                                       (s, ce) => ce.CanExecute = true));

                base.Init();

                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    if (CurrentApp != null)
                    {
                        CurrentApp.SendLoadedMessage();
                    }
                    LoadModuleInfos();
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();

                    InitThemeInfoItems();
                    InitLangInfoItems();
                    InitUserInfo();
                    CreateModuleItems();

                    //ChangeTheme();
                    ChangeLanguage();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #5
0
        private void StopCaculateThread()
        {
            try
            {
                if (mThreadCaculate != null)
                {
                    mThreadCaculate.Abort();
                }
                mThreadCaculate = null;

                CurrentApp.WriteLog("StopCaculateThread", string.Format("Thread stopped."));
            }
            catch (Exception ex)
            {
                CurrentApp.WriteLog("StopCaculateThread", string.Format("Fail.\t{0}", ex.Message));
            }
        }
コード例 #6
0
        private void CreateAlarmMessageItems()
        {
            try
            {
                mListAlarmMessageItems.Clear();
                for (int i = 0; i < mListAlarmMessageInfos.Count; i++)
                {
                    var info = mListAlarmMessageInfos[i];

                    AlarmMessageItem item = new AlarmMessageItem();
                    item.Info       = info;
                    item.CurrentApp = CurrentApp;
                    item.SerialID   = info.SerialID;
                    item.Name       = info.Name;
                    item.Type       = info.Type.ToString();
                    item.Rank       = info.Rank.ToString();
                    item.Value      = info.Value;
                    item.Color      = info.Color;
                    item.Icon       = info.Icon;
                    item.HoldTime   = info.HoldTime.ToString();

                    item.Type     = CurrentApp.GetLanguageInfo(string.Format("4415015{0}", info.Type.ToString("000")), info.Type.ToString());
                    item.StrState = info.State == 0
                        ? CurrentApp.GetLanguageInfo("4415021000", "Enable")
                        : CurrentApp.GetLanguageInfo("4415021002", "Disable");
                    item.BrushColor = GetBrushFromColorString(info.Color);

                    string strState = string.Empty;
                    if (info.StateID > 0)
                    {
                        var agentState = mListAgentStateInfos.FirstOrDefault(s => s.ObjID == info.StateID);
                        if (agentState != null)
                        {
                            strState = agentState.Name;
                        }
                    }
                    item.RelativeState = strState;

                    mListAlarmMessageItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #7
0
        private void InitPropertyItems()
        {
            try
            {
                mListWidgetPropertyItems.Clear();
                for (int i = 0; i < mListWidgetPropertyInfos.Count; i++)
                {
                    var info = mListWidgetPropertyInfos[i];
                    WidgetPropertyItem item = new WidgetPropertyItem();
                    item.WidgetID     = info.WidgetID;
                    item.PropertyID   = info.PropertyID;
                    item.Name         = info.Name;
                    item.Display      = CurrentApp.GetLanguageInfo(string.Format("1206WP{0}{1}", info.WidgetID, info.PropertyID.ToString("000")), info.Name);
                    item.Description  = item.Display;
                    item.PropertyInfo = info;
                    GetItemDescription(item);

                    var propertyValue =
                        mListWidgetPropertyValues.FirstOrDefault(
                            p =>
                            p.WidgetID == item.WidgetID && p.UserID == CurrentApp.Session.UserID &&
                            p.PropertyID == item.PropertyID);
                    if (propertyValue == null)
                    {
                        propertyValue            = new UserWidgetPropertyValue();
                        propertyValue.WidgetID   = item.WidgetID;
                        propertyValue.UserID     = CurrentApp.Session.UserID;
                        propertyValue.PropertyID = item.PropertyID;
                        propertyValue.Value01    = info.DefaultValue;
                        mListWidgetPropertyValues.Add(propertyValue);
                    }
                    item.PropertyValue = propertyValue;

                    item.CurrentApp            = CurrentApp;
                    item.WidgetItem            = WidgetItem;
                    item.ListAllPropertyItems  = mListWidgetPropertyItems;
                    item.ListAllPropertyValues = mListWidgetPropertyValues;

                    mListWidgetPropertyItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #8
0
 public void InitLanguage()
 {
     LabelOccurs.Content = CurrentApp.GetLanguageInfo("2402015", "Execution cycle");
     LabelOccursDailyMonthlyTip.Content = string.Empty;
     LabelFirstDay.Content           = CurrentApp.GetLanguageInfo("2402L017", "The first day");
     cmbSunday.Content               = CurrentApp.GetLanguageInfo("2402012", "Sunday");
     cmbMonday.Content               = CurrentApp.GetLanguageInfo("2402013", "Monday");
     LabelFirstDayOfWeek.Content     = CurrentApp.GetLanguageInfo("2402L018", "The first day of the week");
     cmbOccursD.Content              = CurrentApp.GetLanguageInfo("2402ComboTagD", "Day");
     cmbOccursM.Content              = CurrentApp.GetLanguageInfo("2402ComboTagM", "Month");
     cmbOccursW.Content              = CurrentApp.GetLanguageInfo("2402ComboTagW", "Week");
     cmbOccursU.Content              = CurrentApp.GetLanguageInfo("2402ComboTagU", "Custom");
     chkUpdateKeyImmediately.Content = CurrentApp.GetLanguageInfo("2402014", "Immediate update key");
     chkUpdateCycle.Content          = CurrentApp.GetLanguageInfo("2402015", "Update Period");
     LabelExecutionInterval.Content  = CurrentApp.GetLanguageInfo("2402L025", "Execution Interval");
     LabelIntervalDays.Content       = CurrentApp.GetLanguageInfo("2402L026", "day");
 }
コード例 #9
0
 private void ArrangeSeat()
 {
     try
     {
         double totalWidth = BorderRegionMap.ActualWidth;
         double totalHeight = BorderRegionMap.ActualHeight;
         double x = 0, y = 0;
         int    count = mListSeatItems.Count;
         for (int i = 0; i < count; i++)
         {
             var item = mListSeatItems[i];
             item.Left = (int)Math.Round(x);
             item.Top  = (int)Math.Round(y);
             var info = item.Info;
             if (info != null)
             {
                 info.Left = item.Left;
                 info.Top  = item.Top;
             }
             var panel = item.SeatPanel;
             if (panel != null)
             {
                 panel.SetPosition();
             }
             //基本的排列策略,更为复杂的排列策略以后实现
             //每个座位是 80 * 80 ,座位与座位之间间隔5,从左向右,从上到下顺序排列
             x += 80 + 5;
             if (x + 80 + 5 >= totalWidth)
             {
                 x  = 0;
                 y += 80 + 5;
             }
             if (y + 80 + 5 >= totalHeight)
             {
                 //空间不足
                 ShowException(CurrentApp.GetLanguageInfo("4412N007", string.Format("No enough area, some seat can not arrange!")));
                 return;
             }
         }
         ShowInformation(CurrentApp.GetLanguageInfo("4412N008", "Arrange seat end."));
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
コード例 #10
0
ファイル: UC_KeyWorld.xaml.cs プロジェクト: chenmj201601/UMP
        /// <summary>
        /// 创建listview显示的列
        /// </summary>
        private void CreateColumnsItems()
        {
            try
            {
                GridView             gv = new GridView();
                GridViewColumn       gvc;
                GridViewColumnHeader gvch;
                for (int i = 0; i < mListColumnItems.Count; i++)
                {
                    ViewColumnInfo columnInfo = mListColumnItems[i];
                    if (columnInfo.Visibility == "1")
                    {
                        gvc          = new GridViewColumn();
                        gvch         = new GridViewColumnHeader();
                        gvch.Content = columnInfo.Display;
                        string str = CurrentApp.Session.LangTypeID.ToString();
                        gvch.Content = CurrentApp.GetLanguageInfo(string.Format("COL{0}{1}", mViewID, columnInfo.ColumnName), columnInfo.Display);
                        gvch.ToolTip = CurrentApp.GetLanguageInfo(string.Format("COL{0}{1}", mViewID, columnInfo.ColumnName), columnInfo.Display);
                        gvc.Header   = gvch;
                        gvc.Width    = columnInfo.Width;

                        DataTemplate dt = null;
                        if (columnInfo.ColumnName == "KeyWorldColor")
                        {
                            dt = Resources["ColorCellTemplate"] as DataTemplate;
                        }
                        if (dt == null)
                        {
                            string strColName = columnInfo.ColumnName;
                            gvc.DisplayMemberBinding = new Binding(strColName);
                        }
                        else
                        {
                            gvc.CellTemplate = dt;
                        }
                        gv.Columns.Add(gvc);
                    }
                }
                int iCount = gv.Columns.Count;
                lvKeyWorldsObject.View = gv;
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #11
0
        public override void ChangeLanguage()
        {
            try
            {
                base.ChangeLanguage();

                CreateOperationButton();
                InitTaskDetailColumns();

                SetPageContentLanguage();

                //给换语言包
                ExpanderBasic.Header = CurrentApp.GetLanguageInfo("3103T00052", "Basic Operations");
                ExpanderOther.Header = CurrentApp.GetLanguageInfo("3103T00053", "Other Position");
            }
            catch { }
        }
コード例 #12
0
        private async Task PurchaseHelper(string productId)
        {
            if (_licenseInformation != null)
            {
                if (!_licenseInformation.ProductLicenses[productId].IsActive)
                {
                    try
                    {
                        var results = await CurrentApp.RequestProductPurchaseAsync(productId);

                        //Check the license state to determine if the in-app purchase was successful.
                        if (results.Status == ProductPurchaseStatus.Succeeded)
                        {
                            var launchQuery = new QueryString()
                            {
                                { ToastAssistant.LaunchAction, ToastAssistant.GoToTrello }
                            };
                            ToastAssistant.Instance.SendGenericToast("Assets/Developer.png", "Jake (Developer)", "Thank you for your donation! You have been granted \"Early Access\" to new features. Track development progress on trello.", launchQuery, 168.0);
                        }
                    }
                    catch (Exception)
                    {
                        var launchQuery = new QueryString()
                        {
                            { ToastAssistant.LaunchAction, ToastAssistant.GoToDonationPage }
                        };
                        ToastAssistant.Instance.SendGenericToast("Assets/DiscordLogoSquare.png", "Donation Failed", "An unexpected error occured during donation. Please try again.", launchQuery, 24.0);
                    }
                }
            }
            else
            {
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                              async() =>
                {
                    var popup = new MessageDialog(
                        "Something went wrong on our end. The information has been sent to the developer and you have been granted early access until this issue is resolved.",
                        "Donation Failed");
                    await popup.ShowAsync();

                    //GNARLY_TODO: Log this to the server.
                });
            }

            return;
        }
コード例 #13
0
        private void InitCTIType()
        {
            //加载CTI类型下拉对象
            List <BasicInfoData> TempBasicInfo = WizardHelper.ListAllBasicInfos.Where(p => p.InfoID == 111000300).ToList();

            mListCTITypeItems.Clear();
            foreach (BasicInfoData info in TempBasicInfo)
            {
                PropertyValueEnumItem propertyValueItem = new PropertyValueEnumItem();
                propertyValueItem.Value   = info.Value;
                propertyValueItem.Display =
                    CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", info.InfoID, info.SortID.ToString("000")),
                                               info.Icon);
                propertyValueItem.Info = info;
                mListCTITypeItems.Add(propertyValueItem);
            }
        }
コード例 #14
0
        private void RemoveTabItem()
        {
            try
            {
                if (mListTabItems.Count <= 1)
                {
                    ShowException(CurrentApp.GetMessageLanguageInfo("013", "At least one tab item"));
                    return;
                }
                var tabItem = TabControlCondition.SelectedItem as ConditionTabItem;

                for (int j = 0; j < tabItem.Items.Count; j++)
                {
                    if (tabItem.Items[j].Name == "TimeTypeFromTo")
                    {
                        ShowException(CurrentApp.GetLanguageInfo("3102N038", "Can't delete the TabItem containing TimeTypeFromTo"));//加语言包~~
                        return;
                    }
                }
                if (tabItem != null)
                {
                    var result = MessageBox.Show(string.Format("{0}\r\n{1}",
                                                               CurrentApp.GetMessageLanguageInfo("012", "Confirm remove tab?"),
                                                               tabItem.TabName),
                                                 CurrentApp.AppName,
                                                 MessageBoxButton.YesNo,
                                                 MessageBoxImage.Question);
                    if (result == MessageBoxResult.Yes)
                    {
                        for (int i = tabItem.Items.Count - 1; i >= 0; i--)
                        {
                            ConditionItemItem item = tabItem.Items[i];
                            item.IsUserItem = false;
                            tabItem.Items.Remove(item);
                            mListUserConditions.Remove(item);
                            mListAvaliableConditions.Add(item);
                        }
                        mListTabItems.Remove(tabItem);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #15
0
ファイル: UCNMonPanel.xaml.cs プロジェクト: chenmj201601/UMP
        private void StopNMonObject(bool isClose)
        {
            try
            {
                string strOpt = S2102Consts.OPT_STOPNETMON.ToString();
                if (isClose)
                {
                    strOpt = S2102Consts.OPT_CLOSENETMON.ToString();
                }
                if (mMonitorClient == null)
                {
                    return;
                }
                if (mMonitorObject == null)
                {
                    return;
                }
                OperationReturn optReturn;
                RequestMessage  request = new RequestMessage();
                request.Command = (int)Service04Command.ReqStopNMon;
                request.ListData.Add(mMonitorObject.MonID);
                optReturn = mMonitorClient.SendMessage(request);
                if (!optReturn.Result)
                {
                    #region 写操作日志

                    CurrentApp.WriteOperationLog(strOpt, ConstValue.OPT_RESULT_EXCEPTION,
                                                 string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));

                    #endregion

                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                }

                #region 写操作日志

                CurrentApp.WriteOperationLog(strOpt, ConstValue.OPT_RESULT_SUCCESS,
                                             string.Format("{0}[{1}]", mMonitorObject.ObjValue, Utils.FormatOptLogString(string.Format("OBJ{0}", mMonitorObject.ObjType))));

                #endregion
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #16
0
 public override void ChangeLanguage()
 {
     base.ChangeLanguage();
     ChkPaperName.Content       = CurrentApp.GetLanguageInfo("3603T00027", "Paper Name");
     ChkPaperNum.Content        = CurrentApp.GetLanguageInfo("3603T00028", "Paper Num");
     ChkPaperType.Content       = CurrentApp.GetLanguageInfo("3603T00029", "Paper Type");
     ChkIntegrity.Content       = CurrentApp.GetLanguageInfo("3603T00030", "Integrity");
     ComBoxIntegrity1.Content   = CurrentApp.GetLanguageInfo("3603T00072", "Y");
     ComBoxIntegrity2.Content   = CurrentApp.GetLanguageInfo("3603T00073", "N");
     TxStartTime.Text           = CurrentApp.GetLanguageInfo("3603T00085", "Create Time");
     TxEndTime.Text             = CurrentApp.GetLanguageInfo("3603T00032", "To");
     ButSearchPaper.Content     = CurrentApp.GetLanguageInfo("3603T00033", "Search");
     BtnAddPaper.Content        = CurrentApp.GetLanguageInfo("3603T00034", "Add");
     BtnClose.Content           = CurrentApp.GetLanguageInfo("3603T00035", "Close");
     PaperInfoTable.Title       = CurrentApp.GetLanguageInfo("3603T00036", "Paper");
     CmbPaperType.SelectedIndex = -1;
 }
コード例 #17
0
        private void LoadUserOperations()
        {
            try
            {
                mListUserOperations.Clear();
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)RequestCode.WSGetUserOptList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                webRequest.ListData.Add("44");
                webRequest.ListData.Add("4415");
                CurrentApp.MonitorHelper.AddWebRequest(webRequest);
                Service11012Client client = new Service11012Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                CurrentApp.MonitorHelper.AddWebReturn(webReturn);
                if (!webReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <OperationInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    OperationInfo optInfo = optReturn.Data as OperationInfo;
                    if (optInfo != null)
                    {
                        optInfo.Display     = CurrentApp.GetLanguageInfo(string.Format("FO{0}", optInfo.ID), optInfo.ID.ToString());
                        optInfo.Description = optInfo.Display;
                        mListUserOperations.Add(optInfo);
                    }
                }

                CurrentApp.WriteLog("LoadOperations", string.Format("Load end.\t{0}", mListUserOperations.Count));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        public async Task <ListingInformation> GetListingInformationAsync()
        {
            try
            {
                if (DebugTools.DebugMode)
                {
                    return(await CurrentAppSimulator.LoadListingInformationAsync());
                }

                return(await CurrentApp.LoadListingInformationAsync());
            }
            catch (Exception ex)
            {
                DebugTools.PrintOutException(ex, "License Load failed");
                return(null);
            }
        }
コード例 #19
0
        protected override void Init()
        {
            try
            {
                PageName  = "QueryConditionSetting";
                StylePath = "UMPS3107/MainPageStyle.xaml";
                base.Init();

                CurrentApp.SendLoadedMessage();
                ChangeTheme();
                ChangeLanguage();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #20
0
        public async Task <IList <ProductItem> > LoadProductsAsync(IEnumerable <string> supportedProductIds, string localizedPurchasedText = null)
        {
            var productItems = new List <ProductItem>();

            // fallback purchased text
            if (string.IsNullOrEmpty(localizedPurchasedText))
            {
                localizedPurchasedText = "purchased";
            }

            try
            {
                // load supported products
#if DEBUG
                ListingInformation lisitingInfo = await CurrentAppSimulator.LoadListingInformationByProductIdsAsync(supportedProductIds);
#else
                ListingInformation lisitingInfo = await CurrentApp.LoadListingInformationByProductIdsAsync(supportedProductIds);
#endif

                foreach (var id in lisitingInfo.ProductListings.Keys)
                {
                    ProductListing product         = lisitingInfo.ProductListings[id];
                    var            isProductActive = IsProductActive(id);
                    var            status          = isProductActive ? localizedPurchasedText : product.FormattedPrice;
                    var            imageLink       = string.Empty;
                    productItems.Add(
                        new ProductItem
                    {
                        ImageUri    = product.ImageUri,
                        Name        = product.Name,
                        Description = product.Description,
                        Status      = status,
                        Id          = id,
                        IsActive    = isProductActive
                    }
                        );
                }
            }
            catch (Exception e)
            {
                Logger.WriteLine(e, "Loading of products failed");
                return(null);
            }

            return(productItems);
        }
コード例 #21
0
 public override void ChangeLanguage()
 {
     base.ChangeLanguage();
     ChkTestNum.Content     = CurrentApp.GetLanguageInfo("3603T00009", "Test Num");
     ChkPaperNum.Content    = CurrentApp.GetLanguageInfo("3603T00010", "Paper Num");
     ChkPaperName.Content   = CurrentApp.GetLanguageInfo("3603T00011", "Paper Name");
     ChkEditorNum.Content   = CurrentApp.GetLanguageInfo("3603T00014", "Test Set Person Num");
     ChkEditorName.Content  = CurrentApp.GetLanguageInfo("3603T00015", "Test Set Person Name");
     ChkTestState.Content   = CurrentApp.GetLanguageInfo("3603T00017", "Test State");
     ChkTestTime.Content    = CurrentApp.GetLanguageInfo("3603T00013", "Test Time");
     TbFrom.Text            = CurrentApp.GetLanguageInfo("3603T00085", "Create Time");
     ButOk.Content          = CurrentApp.GetLanguageInfo("3603T00051", "OK");
     ButClose.Content       = CurrentApp.GetLanguageInfo("3603T00052", "Close");
     ComBoxUsedNum0.Content = CurrentApp.GetLanguageInfo("3603T00079", "All");
     ComBoxUsedNum1.Content = CurrentApp.GetLanguageInfo("3603T00086", "Y");
     ComBoxUsedNum2.Content = CurrentApp.GetLanguageInfo("3603T00087", "N");
 }
コード例 #22
0
 public void RemoveAd()
 {
     Dispatcher.BeginInvoke(async() =>
     {
         try
         {
             var x = CurrentApp.RequestProductPurchaseAsync(IAP_PREMIUM, false);
             await x;
             if (x.Status == Windows.Foundation.AsyncStatus.Completed)
             {
                 Main.SwitchToPremium();
                 CloseAd();
             }
         }
         catch { }
     });
 }
コード例 #23
0
        public static void ReportConsumableFulfillment(string productId, Guid transactionId,
                                                       Action <CallbackResponse <FulfillmentResult> > OnReportConsumableFulfillmentFinished)
        {
            Utils.RunOnWindowsUIThread(async() =>
            {
                Windows.ApplicationModel.Store.FulfillmentResult result = Windows.ApplicationModel.Store.FulfillmentResult.ServerError;
                try
                {
                    if (_isLicenseSimulationOn)
                    {
                        result = await CurrentAppSimulator.ReportConsumableFulfillmentAsync(productId, transactionId);
                    }
                    else
                    {
                        result = await CurrentApp.ReportConsumableFulfillmentAsync(productId, transactionId);
                    }
                }
                catch (Exception ex)
                {
                    DebugLog.Log(LogLevel.Error, "Error while reporting consumable fulfillment " + ex.ToString());
                    Utils.RunOnUnityAppThread(() => { if (OnReportConsumableFulfillmentFinished != null)
                                                      {
                                                          OnReportConsumableFulfillmentFinished(new CallbackResponse <FulfillmentResult> {
                                Status = CallbackStatus.Failure, Exception = ex, Result = FulfillmentResult.ServerError
                            });
                                                      }
                                              });
                    return;
                }

                // This should not really be throwing exceptions.. If it does, they will be raised on the Unity thread anyways, so game should handle it
                Utils.RunOnUnityAppThread(() =>
                {
                    if (OnReportConsumableFulfillmentFinished != null)
                    {
                        OnReportConsumableFulfillmentFinished(
                            new CallbackResponse <FulfillmentResult>
                        {
                            Result    = (Microsoft.UnityPlugins.FulfillmentResult)result,
                            Exception = null,
                            Status    = CallbackStatus.Success
                        });
                    }
                });
            });
        }
コード例 #24
0
        private void LoadRegionUserIDs()
        {
            try
            {
                mListRegionUserIDs.Clear();
                if (RegionItem == null)
                {
                    return;
                }
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S4410Codes.GetRegionUserList;
                webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                webRequest.ListData.Add(RegionItem.ObjID.ToString());
                Service44101Client client = new Service44101Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service44101"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("WSFail\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                if (webReturn.ListData == null)
                {
                    ShowException(string.Format("Fail.\tListData is null"));
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    string strID = webReturn.ListData[i];
                    long   id;
                    if (long.TryParse(strID, out id))
                    {
                        mListRegionUserIDs.Add(id);
                    }
                }

                CurrentApp.WriteLog("LoadRegionUserIDs", string.Format("Load end.\t{0}", mListRegionUserIDs.Count));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #25
0
        public async void CommandHandlers(IUICommand commandLabel)
        {
            var Actions = commandLabel.Label;

            if (this.resourceLoader.GetString("StaticButtonBuy") == Actions)
            {
                if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                {
                    ListingInformation listing = await CurrentApp.LoadListingInformationAsync();

                    var superweapon = listing.ProductListings.FirstOrDefault(p => p.Value.ProductId == Constant.IAP_PREMIUN);

                    try
                    {
                        ListingInformation LicensePremiumID = await Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationByProductIdsAsync(new string[] { Constant.IAP_PREMIUN });

                        string x = await CurrentApp.RequestProductPurchaseAsync(LicensePremiumID.ProductListings.ToList()[0].Value.ProductId, false);

                        var            productLicenses = CurrentApp.LicenseInformation.ProductLicenses;
                        ProductLicense tokenLicense    = productLicenses[Constant.IAP_PREMIUN];

                        if (tokenLicense.IsActive)
                        {
                            LocalProperties.SaveToLP(LocalProperties.LP_active_premium, "true");
                            new MessageDialog("Платный функционал успешно активирован").ShowAsync();
                        }
                        else
                        {
                            new MessageDialog("Не удалось активировать!").ShowAsync();
                        }
                    }
                    catch (Exception ex)
                    {
                        new MessageDialog("Неизвестная ошибка").ShowAsync();
                    }
                }
                else
                {
                    new MessageDialog(resourceLoader.GetString("Error_InternetConnection"), resourceLoader.GetString("Error")).ShowAsync();
                }
            }
            else
            {
                this.resourceLoader.GetString("StaticButtonCancel");
            }
        }
コード例 #26
0
        public override void ChangeLanguage()
        {
            base.ChangeLanguage();

            try
            {
                var parent = Parent as PopupPanel;
                if (parent != null)
                {
                    parent.Title = CurrentApp.GetLanguageInfo("4412016", "Region Management");
                }

                BtnConfirm.Content = CurrentApp.GetLanguageInfo("COM001", "Confirm");
                BtnClose.Content   = CurrentApp.GetLanguageInfo("COM002", "Close");
            }
            catch { }
        }
コード例 #27
0
        public static async Task <ProductPurchaseStatus> RequestPuracheAsync(string featureName)
        {
            try
            {
                PurchaseResults results;
#if DEBUG
                results = await CurrentAppSimulator.RequestProductPurchaseAsync(featureName);
#else
                results = await CurrentApp.RequestProductPurchaseAsync(featureName);
#endif
                return(results.Status);
            }
            catch (Exception)
            {
                return(ProductPurchaseStatus.NotFulfilled);
            }
        }
コード例 #28
0
ファイル: UCSMonPanel.xaml.cs プロジェクト: chenmj201601/UMP
        private void Init()
        {
            try
            {
                string strTitle = string.Format("{0} —— ", CurrentApp.GetLanguageInfo("2102016", "Screen Monitor"));
                if (MonitorData != null)
                {
                    mMonitorItem                = MonitorItem.CreateItem(MonitorData);
                    mMonitorItem.CurrentApp     = CurrentApp;
                    mMonitorItem.ListUserParams = ListUserParams;
                    mMonitorObject              = new MonitorObject();
                    mMonitorObject.MonType      = MonitorType.MonScr;
                    mMonitorObject.ObjID        = MonitorData.ObjID;
                    mMonitorObject.ObjType      = MonitorData.ObjType;
                    mMonitorObject.ObjValue     = MonitorData.Name;
                    mMonitorObject.Role         = 2;
                    string strOther03 = MonitorData.Other03;
                    if (!string.IsNullOrEmpty(strOther03))
                    {
                        string[] arrOther03 = strOther03.Split(new[] { ';' }, StringSplitOptions.None);
                        if (arrOther03.Length > 1)
                        {
                            mMonitorObject.Other03 = arrOther03[1];
                        }
                        else if (arrOther03.Length > 0)
                        {
                            mMonitorObject.Other03 = arrOther03[0];
                        }
                    }
                    mMonitorItem.ScreenChanMonObject = mMonitorObject;
                    Dispatcher.Invoke(new Action(mMonitorItem.UpdateState));
                    DataContext = mMonitorItem;
                    strTitle   += mMonitorItem.Name;

                    ImageIcon.SetResourceReference(StyleProperty,
                                                   string.Format("NMonImageIcon{0}Style", mMonitorItem.ObjType));

                    InitMonitorClient();
                }
                TxtObjListTitle.Text = strTitle;
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #29
0
 private void TxtKeyword_OnTextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         if (TxtKeyword.Text.Length > 120)
         {
             MessageBox.Show(CurrentApp.GetLanguageInfo("5101T00066",
                                                        "Add content should not exceed 120 characters."),
                             CurrentApp.GetLanguageInfo("5101T00050", "Warning"),
                             MessageBoxButton.OK);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
コード例 #30
0
 private void InitToolButtonItems()
 {
     try
     {
         mListToolButtonItems.Clear();
         ToolButtonItem item = new ToolButtonItem();
         item.Name    = S1206Consts.TOOLBTN_WIDGETCONFIG;
         item.Display = CurrentApp.GetLanguageInfo("1206TB010", "Config");
         item.ToolTip = item.Display;
         item.Icon    = "Images/00008.png";
         mListToolButtonItems.Add(item);
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }