コード例 #1
0
        async Task PopulateDeviceStatus()
        {
            try
            {
                statusMsg.Foreground = new SolidColorBrush(Colors.Green);
                statusMsg.Text       = Helper.GetResourceString("ID_STATUS_DEVSTATUS_MSG");
                getDeviceStatusResponse1 devStatus = await Stage2Interface.GetInstance().GetDeviceStatusAsync();

                if (devStatus != null)
                {
                    statusLabel.Text = devStatus.getDeviceStatusResponse.Status.DeviceStatus.ToString();
                    prinStatus.Text  = devStatus.getDeviceStatusResponse.Status.PrinterStatus.ToString();
                    statusDetailType[] statusTypes = devStatus.getDeviceStatusResponse.Status.Detail;

                    statusDetail.Children.Clear();
                    foreach (statusDetailType type in statusTypes)
                    {
                        TextBlock txtBlk = new TextBlock();

                        string strTitle   = string.Empty;
                        string strContent = string.Empty;
                        Helper.GetDisplayStrings(type.CodeName, out strTitle, out strContent);
                        txtBlk.Text = strTitle;

                        if (string.IsNullOrEmpty(strTitle))
                        {
                            txtBlk.Text = type.CodeName;
                        }
                        txtBlk.FontSize = 20;
                        statusDetail.Children.Add(txtBlk);
                    }

                    statusExpander.IsExpanded = true;
                }
            }
            catch (FaultException <OutputManagementService.eBridgeServiceExceptionType> ex)
            {
                //statusMsg.Foreground = new SolidColorBrush(Colors.Red);
                //statusMsg.Text = ex.Detail.Description;

                if (ex is FaultException <OutputManagementService.eBridgeServiceExceptionType> )
                {
                    FaultException <OutputManagementService.eBridgeServiceExceptionType> fx = ex as FaultException <OutputManagementService.eBridgeServiceExceptionType>;
                    if (fx.Detail.FaultType == "ERR_EBS_INVALID_TOKEN")
                    {
                        statusMsg.Foreground = new SolidColorBrush(Colors.Blue);
                        statusMsg.Text       = Helper.GetResourceString("ID_REFRESH");
                        await Stage2Interface.GetInstance().InternalLogin();

                        PopulateDeviceStatus();
                    }
                }
            }
            catch (TimeoutException)
            {
                statusMsg.Foreground = new SolidColorBrush(Colors.Red);
                statusMsg.Text       = Helper.GetResourceString("ID_STATUS_DEVSTATUS_TIMEOUT_MSG");
            }
        }
コード例 #2
0
        async Task PostNotifications()
        {
            getDeviceStatusResponse1 devStatus = await Stage2Interface.GetInstance().GetDeviceStatusAsync();

            if (devStatus != null)
            {
                statusDetailType[] statusTypes = devStatus.getDeviceStatusResponse.Status.Detail;

                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                              () =>
                {
                    HomeInst.StatusExpander.IsExpanded = false;
                    HomeInst.StatusBlock.Children.Clear();

                    foreach (statusDetailType type in statusTypes)
                    {
                        TextBlock txtBlk = new TextBlock();
                        Helper.GetDisplayStrings(type.CodeName, out strTitle, out strContent);
                        txtBlk.Text = strTitle;
                        if (string.IsNullOrEmpty(strTitle))
                        {
                            txtBlk.Text = type.CodeName;
                        }
                        txtBlk.FontSize = 20;
                        HomeInst.StatusBlock.Children.Add(txtBlk);
                    }

                    HomeInst.StatusLabel.Text          = devStatus.getDeviceStatusResponse.Status.DeviceStatus.ToString();
                    HomeInst.PrinStatus.Text           = devStatus.getDeviceStatusResponse.Status.PrinterStatus.ToString();
                    HomeInst.StatusExpander.IsExpanded = true;
                });

                bool bCoverNtfctnEnable = localSettings.Values.ContainsKey("CoverOpenNtfctn") ? (bool)localSettings.Values["CoverOpenNtfctn"] : false;
                if (bCoverNtfctnEnable)
                {
                    foreach (statusDetailType type in statusTypes)
                    {
                        Helper.GetDisplayStrings(type.CodeName, out strTitle, out strContent);

                        switch (type.CodeName)
                        {
                        case "ADUMissingError":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.ADUMissingError.ToString());
                            break;

                        case "ADFCoverOpen":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.ADFCoverOpen.ToString());
                            break;

                        case "Drawer1Open":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer1Open.ToString());
                            break;

                        case "Drawer2Open":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer2Open.ToString());
                            break;

                        case "Drawer3Open":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer3Open.ToString());
                            break;

                        case "Drawer4Open":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer4Open.ToString());
                            break;
                        }
                    }
                }

                bool bDrawOpenNtfctnEnable = localSettings.Values.ContainsKey("DrawEmptyNtfctn") ? (bool)localSettings.Values["DrawEmptyNtfctn"] : false;
                if (bDrawOpenNtfctnEnable)
                {
                    foreach (statusDetailType type in statusTypes)
                    {
                        Helper.GetDisplayStrings(type.CodeName, out strTitle, out strContent);

                        switch (type.CodeName)
                        {
                        case "Drawer1PaperEmpty":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer1PaperEmpty.ToString());
                            break;

                        case "Drawer2PaperEmpty":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer2PaperEmpty.ToString());
                            break;

                        case "Drawer3PaperEmpty":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer3PaperEmpty.ToString());
                            break;

                        case "Drawer4PaperEmpty":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.Drawer4PaperEmpty.ToString());
                            break;
                        }
                    }
                }

                bool bUsedTonerFullNtfctnEnable = localSettings.Values.ContainsKey("NewWasteTonerNtfctn") ? (bool)localSettings.Values["NewWasteTonerNtfctn"] : false;
                if (bUsedTonerFullNtfctnEnable)
                {
                    bool bExitLoop = false;
                    foreach (statusDetailType type in statusTypes)
                    {
                        Helper.GetDisplayStrings(type.CodeName, out strTitle, out strContent);

                        switch (type.CodeName)
                        {
                        case "WasteTonerBoxNearFull":
                            NotificationHandler.PostAToast(strTitle, strContent, eNotification.NewWasteTonerBox.ToString());
                            bExitLoop = true;
                            break;
                        }

                        if (bExitLoop)
                        {
                            break;
                        }
                    }
                }
            }

            bool bJobNtfctnEnable = localSettings.Values.ContainsKey("JobSuspendNtfctn") ? (bool)localSettings.Values["JobSuspendNtfctn"] : false;

            if (bJobNtfctnEnable)
            {
                getAllWorkflowResponse1 allWorkflowResponse = await Stage2Interface.GetInstance().GetAllWorkFlows();

                int iAllWorkflows = allWorkflowResponse.getAllWorkflowResponse.WorkflowList.Length;

                foreach (workflowType workItem in allWorkflowResponse.getAllWorkflowResponse.WorkflowList)
                {
                    if (string.Equals(workItem.BasicInfo.Status, eNotification.Suspended.ToString(), StringComparison.CurrentCultureIgnoreCase) == true)
                    {
                        string stTemp = Helper.GetResourceString("ID_NT_TITLE_JOBSUSPEND");
                        strTitle   = workItem.Name + stTemp;
                        strContent = ((printJobType)workItem.StepInfo[0].Item).DocumentName;
                        NotificationHandler.PostAToast(strTitle, strContent, eNotification.Completed.ToString());
                    }
                }
            }
        }