Example #1
0
        public void MessageWarningMessageCanBeCreated()
        {
            string  wm_text = "This is an warning message.";
            Message wm      = new WarningMessage(wm_text);

            Assert.AreEqual(wm_text, wm.Text);
        }
        /// <summary>
        /// This methods handles the click on the global button. It checks if default information is valid,
        /// if it is valid is loads the Devices main screen, otherwise it presents the Auth0 login screen.
        /// </summary>
        async Task ToGlobalScreen()
        {
            userDefaults.SetString(bool.FalseString, strings.defaultsLocalHestia);

            if (HasValidGlobalLogin()) // Go to Devices main
            {
                SetValuesAndSegueToServerSelectGlobal();
            }
            else // Present Auth0 login
            {
                Task <LoginResult> loginResult = GetLoginResult();
                LoginResult        logResult   = await loginResult;

                Globals.LocalLogin = false;

                if (!logResult.IsError)
                {
                    userDefaults.SetString(logResult.AccessToken, strings.defaultsAccessTokenHestia);
                    SetValuesAndSegueToServerSelectGlobal(logResult.AccessToken);
                }
                // Do not display a warning if user click back to the local/global screen
                else if (!(logResult.Error == "UserCancel"))
                {
                    WarningMessage.Display("Login failed", logResult.Error, this);
                }
            }
        }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                StudentSections studentSections = new StudentSections();
                studentSections.SectionID          = Convert.ToInt32(txtSectionName.Tag);
                studentSections.SectionName        = txtSectionName.Text;
                studentSections.SessionID          = Convert.ToInt64(cmbStudentSession.SelectedValue);
                studentSections.CreatedDateTime    = System.DateTime.Now;
                studentSections.CreatedByID        = Convert.ToInt32(this.Tag);
                studentSections.LastUpdateByID     = Convert.ToInt32(this.Tag);
                studentSections.LastUpdateDateTime = System.DateTime.Now;
                studentSections.IsEnabled          = chkIsEnabled.Checked;
                studentSections.Remarks            = txtSectionRemarks.Text;

                long section_id = StudentSectionsController.InsertUpdateStudentSections(studentSections);
                txtSectionName.Tag = section_id;
                if (section_id > 0)
                {
                    SuccessMessage.SHowDialog("Record Entered Successfully ");
                    StudentSectionDataGridView.DataSource = sections;
                }

                else
                {
                    WarningMessage.SHowDialog("Error: Section Not Added");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Abre a conexão com o banco
            dataAccess = DataAccess.Instance;
            dataAccess.MountConnection(FileResource.MapWebResource(Server, "DataAccess.xml"), DatabaseEnum.PrintAccounting);
            dataAccess.OpenConnection();

            String buttonScript = "window.open('ChangePassword.aspx', 'PasswordSettings', 'width=540,height=450');";

            EmbedClientScript.AddElementClickHandler(this.Page, "btnChangePassword", buttonScript);
            // Limpa as mensagens de erro
            lblErrorMessages.Text = "";

            // action:
            //    null -  Sem ação, apenas abre a página de login
            //    0    -  Efetua o Logout, removendo a autenticação previa do usuário
            int     action;
            Boolean paramExists = !String.IsNullOrEmpty(Request.QueryString["action"]);
            Boolean isNumeric   = int.TryParse(Request.QueryString["action"], out action);

            if ((paramExists) && (!isNumeric))
            {
                // Remove todos os controles da página
                controlArea.Controls.Clear();

                // Mostra aviso de inconsistência nos parâmetros
                WarningMessage.Show(controlArea, ArgumentBuilder.GetWarning());
                return;
            }
            if ((paramExists) && (action == 0))
            {
                Authentication.Disauthenticate(Session);
                Response.Redirect("LoginPage.aspx"); // Limpa a QueryString para evitar erros
            }
        }
Example #5
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            // Abre a conexão com o banco
            dataAccess = DataAccess.Instance;
            dataAccess.MountConnection(FileResource.MapWebResource(Server, "DataAccess.xml"), DatabaseEnum.PrintAccounting);
            dataAccess.OpenConnection();

            // Limpa as mensagens de erro
            lblErrorMessages.Text = "";

            // action:
            //    null -  Sem ação, apenas abre a página de login
            //    0    -  Efetua o Logout, removendo a autenticação previa do usuário
            int     action;
            Boolean paramExists = !String.IsNullOrEmpty(Request.QueryString["action"]);
            Boolean isNumeric   = int.TryParse(Request.QueryString["action"], out action);

            if ((paramExists) && (!isNumeric))
            {
                // Remove todos os controles da página
                controlArea.Controls.Clear();

                // Mostra aviso de inconsistência nos parâmetros
                WarningMessage.Show(controlArea, "Os parâmetros passados para a página não estão em um formato válido.");
                return;
            }

            if ((paramExists) && (action == 0))
            {
                Authentication.Disauthenticate(Session);
                Response.Redirect("LoginPage.aspx"); // Limpa a QueryString para evitar erros
            }
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            nbWarning.Visible = false;

            if (IsUserAuthorized(Authorization.ADMINISTRATE))
            {
                if (!Page.IsPostBack)
                {
                    EntityTypeService.RegisterEntityTypes(Request.MapPath("~"));
                    BindGrid();
                }
                else
                {
                    ShowDialog();
                }
            }
            else
            {
                gEntityTypes.Visible = false;
                nbWarning.Text       = WarningMessage.NotAuthorizedToEdit(EntityType.FriendlyTypeName);
                nbWarning.Visible    = true;
            }

            base.OnLoad(e);
        }
Example #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // The list with manufacturers
            collections = new List <string>();
            try
            {
                collections = Globals.ServerToAddDeviceTo.GetCollections();
                foreach (string collection in collections)
                {
                    // Get plugins for this collection
                    List <string> plugins = Globals.ServerToAddDeviceTo.GetPlugins(collection);
                    // Add this collection/plugins combination to hashtable
                    collection_plugins.Add(collection, plugins);
                }
            }
            catch (ServerInteractionException ex)
            {
                Console.WriteLine("Exception while using serverInteractor");
                Console.WriteLine(ex);
                WarningMessage.Display("Exception", "An exception occured on the server trying to get available plugins", this);
            }

            // Contains methods that describe behavior of table
            TableView.Source = new TableSourceAddDeviceManufacturer(collections, collection_plugins, this);
        }
Example #8
0
    public void OnDelete()
    {
        m_deleteProfile = "";
        if (MyInputField != null)
        {
            m_deleteProfile   = MyInputField.text;
            MyInputField.text = "";
        }
        else
        {
            m_deleteProfile = m_savedProfiles [m_selectedIndex];
        }
        if (m_deleteProfile == "")
        {
            m_message.text = "No profile selected to delete";
            return;
        }
        if (!SaveObjManager.Instance.ProfileExists(m_deleteProfile))
        {
            m_message.text = "Profile: " + m_deleteProfile + " does not exist";
            return;
        }
        if (m_deleteProfile == "AutoSave")
        {
            m_message.text = "AutoSave cannot be deleted.";
            return;
        }
        string w = "Are you sure you want to permanently delete: " + m_deleteProfile + "?";

        w += "\n Deleted saves cannot be recovered.";

        WarningMessage.DisplayWarning(w, gameObject, m_delete);
    }
        public void CanCreateWarningMessage()
        {
            var message = WarningMessage.Create("warningMessage");

            Assert.That(message["type"], Is.EqualTo(WarningMessage.MessageType));
            Assert.That(message["message"], Is.EqualTo("warningMessage"));
        }
Example #10
0
        /// <summary>
        /// Starts full calculation proccess.
        /// </summary>
        /// <param name="message">String to be printed through the UI.</param>
        /// <param name="warning">Warning Enum to display to the user.</param>
        /// <param name="passCount">The desired number of completed paystubs.</param>
        public void BeginCalc(Message message, WarningMessage warning, int passCount = 1)
        {
            decimal averagePercentage = 0;
            bool    paystubRatio      = true;
            bool    accuracyOutput    = true;

            Decision = CalculationDecision();

            // Maybe add a name to the paystub collection??
            message(Decision.ToString());

            if (Decision == CalcType.CalcGross)
            {
                averagePercentage = CalculatePercentage();
                SetPercentage(averagePercentage);
                paystubRatio = CheckCompletedPaystubRatio();
                Paystub.GrossFromPercentageList(Paystubs);
                accuracyOutput = CheckPercentageAccuracy();
                RunAverages();
                warning(CheckWarning(paystubRatio, accuracyOutput));
            }
            else if (Decision == CalcType.CalcNet)
            {
                averagePercentage = CalculatePercentage();
                SetPercentage(averagePercentage);
                paystubRatio = CheckCompletedPaystubRatio();
                Paystub.NetFromPercentageList(Paystubs);
                accuracyOutput = CheckPercentageAccuracy();
                RunAverages();
                warning(CheckWarning(paystubRatio, accuracyOutput));
            }
        }
Example #11
0
        /// <summary>
        /// This method is called from <see cref="FinishedLaunching(UIApplication, NSDictionary)"/> if the default is global login.
        /// It assigns to the Global variables that are used for global login.
        /// The function HestiaWebServerInteractor.PostUser() function must be called before other functions are called on the WebServerInteractor.
        /// See, <see cref="HestiaWebServerInteractor"/>
        /// </summary>
        public void SetGlobalsToDefaultsGlobalLogin()
        {
            Globals.HestiaWebserverNetworkHandler = new NetworkHandler(strings.hestiaWebServerAddress, defaultAuth0AccessToken);
            Globals.HestiaWebServerInteractor     = new HestiaWebServerInteractor(Globals.HestiaWebserverNetworkHandler);

            try
            {
                Globals.HestiaWebServerInteractor.PostUser();
            }
            catch (ServerInteractionException ex)
            {
                Console.WriteLine("Exception while posting user. User possibly already exists.");
                Console.WriteLine(ex);
            }
            // Create an empty list in case no servers can be fetched from the Webserver, to prevent NullReferenceException in Devices main screen
            Globals.Auth0Servers = new List <HestiaServer>();
            try
            {
                Globals.Auth0Servers = Globals.HestiaWebServerInteractor.GetServers();
            }
            catch (ServerInteractionException ex)
            {
                Console.WriteLine("Exception while getting servers");
                Console.WriteLine(ex);
                WarningMessage.Display("Exception while getting servers", "Could not get local server list from webserver", Window.RootViewController);
            }
        }
        /// <summary>
        /// Creates the HestiaWebServerInteractor to communicate with the Webserver. It posts the new user and fetches
        /// the list of Local servers from the Webserver. It this succeeds, the Select server screen is shown.
        /// </summary>
        void CreateServerInteractorAndSegue(NetworkHandler networkHandler)
        {
            Globals.HestiaWebServerInteractor = new HestiaWebServerInteractor(Globals.HestiaWebserverNetworkHandler);
            try
            {
                Globals.HestiaWebServerInteractor.PostUser();
            }
            catch (ServerInteractionException ex)
            {
                Console.WriteLine("Exception while posting user. User possibly already exists.");
                Console.WriteLine(ex);
            }
            Globals.Auth0Servers = new List <HestiaServer>();
            try
            {
                List <HestiaServer> servers = Globals.HestiaWebServerInteractor.GetServers();
                Globals.Auth0Servers = servers;
                PerformSegue(strings.segueToLocalGlobalToServerSelect, this);
            }
            catch (ServerInteractionException ex)
            {
                Console.WriteLine("Exception while getting servers");
                Console.WriteLine(ex);
                WarningMessage.Display("Exception whle getting server", "Could not get the server information about local server from Auth0 server.", this);
            }

            PerformSegue(strings.segueToLocalGlobalToServerSelect, this);
        }
        public void Should_serialize_warning_message()
        {
            var message = new WarningMessage("warning");
            var output  = serializeDeserialize <WarningMessage>(message);

            output.Warning.ShouldEqual("warning");
        }
Example #14
0
        public static void SendEvent(WarningMessage warning)
        {
            Console.WriteLine("发送报警事件,{0}", warning.Message);
            DevOpsEvent opsEvent = new DevOpsEvent();

            opsEvent.EventType      = (int)warning.WarningType;
            opsEvent.OperatorDate   = DateTime.Now;
            opsEvent.ProjectNo      = EnvironmentInfo.ProjectNo ?? string.Empty;
            opsEvent.ProjectName    = EnvironmentInfo.ProjectName ?? string.Empty;
            opsEvent.ProjectVersion = EnvironmentInfo.ProjectVersion ?? string.Empty;
            opsEvent.RemoteAccount  = EnvironmentInfo.RemoteAccount ?? string.Empty;
            opsEvent.RemotePassword = EnvironmentInfo.RemotePassword ?? string.Empty;
            opsEvent.ContactPhone   = EnvironmentInfo.ContactPhone ?? string.Empty;
            opsEvent.ContactName    = EnvironmentInfo.ContactName ?? string.Empty;

            try
            {
                string url        = string.Format("{0}/devops/reportDevOpsEvent", EnvironmentInfo.ServerUrl);
                var    returnData = HttpHelper.Post <ReturnData>(url, opsEvent, 3000);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        private void LogAndAddWarningtoData(string warn, ref IDataOutputResult <ExecutionFX> data)
        {
            IWarnings warning = new WarningMessage(warn);

            data.WarningMessage.Add(warning);
            logger.Warn(warn);
        }
Example #16
0
        static void Main(string[] args)
        {
            IMessageSender emailSender        = new EmailSender();
            IMessageSender databaseSender     = new DatabaseSender();
            IMessageSender notificationSender = new NotificationSender();

            Message message = new ErrorMessage();

            message.Subject       = "Test Message";
            message.Body          = "Hi, This is a Test Message";
            message.MessageSender = emailSender;
            message.Send();

            Console.WriteLine("-------------------------------------");

            message.MessageSender = databaseSender;
            message.Send();

            Console.WriteLine("-------------------------------------");

            Message warning = new WarningMessage();

            warning.Subject       = "Test Message";
            warning.Body          = "Hi, This is a Test Message";
            warning.MessageSender = notificationSender;
            warning.Send();

            Console.WriteLine("-------------------------------------");
        }
Example #17
0
        public Message Create(string s, EnumMessageType type)
        {
            Message message = (Message)null;

            switch (type)
            {
            case EnumMessageType.INFO:
            {
                message = new InfoMessage(s);
                break;
            }

            case EnumMessageType.WARNING:
            {
                message = new WarningMessage(s);
                break;
            }

            case EnumMessageType.ERROR:
            {
                message = new ErrorMessage(s);
                break;
            }
            }

            return(message);
        }
Example #18
0
        // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
        //     Constructor
        // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="width">
        ///     [Range(0, 255)]
        ///     [SafetyRange(0, 250)]
        ///     幅
        /// </param>
        /// <param name="height">
        ///     [Range(0, 255)]
        ///     [SafetyRange(0, 250)]
        ///     高さ
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">width、heightが指定範囲外の場合</exception>
        public HitExtendRange(byte width, byte height)
        {
            if (width < MinValue_Width || MaxValue_Width < width)
            {
                throw new ArgumentOutOfRangeException(
                          ErrorMessage.OutOfRange(nameof(width), MinValue_Width, MaxValue_Width, width));
            }
            if (height < MinValue_Height || MaxValue_Height < height)
            {
                throw new ArgumentOutOfRangeException(
                          ErrorMessage.OutOfRange(nameof(height), MinValue_Height, MaxValue_Height, height));
            }

            if (width < SafetyMinValue_Width || SafetyMaxValue_Width < width)
            {
                WodiLibLogger.GetInstance().Warning(
                    WarningMessage.OutOfRange(nameof(width), SafetyMinValue_Width,
                                              SafetyMaxValue_Width, width));
            }
            if (height < SafetyMinValue_Height || SafetyMaxValue_Height < height)
            {
                WodiLibLogger.GetInstance().Warning(
                    WarningMessage.OutOfRange(nameof(height), SafetyMinValue_Height,
                                              SafetyMaxValue_Height, height));
            }

            Width  = width;
            Height = height;
        }
Example #19
0
        private void buttonRoll_Click(object sender, EventArgs e)
        {
            /* If we do consective rolls with a negative modifier, each time we enter here
             * the modifier will be multiplied by -1, becoming positive, so we need to get it
             * again */

            List <string> missingFields = CheckMissingInfo();

            if (!missingFields.Any())
            {
                _diceRollerManager.Modifier = Convert.ToInt32(textBoxDiceRollModifier.Text);
                if (string.Equals(comboBoxModifierSignal.Text, "-"))
                {
                    _diceRollerManager.Modifier *= -1;
                }

                _diceRollerManager.AccumulateValues();
                ShowRollResults();
            }
            else
            {
                StringBuilder warnings = new StringBuilder();
                warnings.AppendFormat($"The required infos are missing: {Environment.NewLine}");

                foreach (var message in missingFields)
                {
                    warnings.AppendFormat($"{message} {Environment.NewLine}");
                }
                WarningMessage.ShowWarningMessage(warnings.ToString());
            }
        }
Example #20
0
    public void QuickLoad()
    {
        PauseGame.Pause(false);
        string w = "Load Last QuickSave? ";

        w += "\n All unsaved Progress will be lost.";
        WarningMessage.DisplayWarning(w, m_pauseMenuUI, quickLoad, "Warning", SetFirstOption);
    }
Example #21
0
 public CommandReturnException(SocketCommandContext context, string description, string title = null)
     : base(title + description)
 {
     EmbedTitle       = title;
     EmbedDescription = description;
     _ = new WarningMessage(description, title)
         .SendAsync(context.Channel);
 }
        private void ShowWarning(String warningMessage)
        {
            // Remove todos os controles da página
            displayArea.Controls.Clear();

            // Renderiza a mensagem na página
            WarningMessage.Show(displayArea, warningMessage);
        }
Example #23
0
 void HandleException(TableSourceDevicesMain source, ServerInteractionException ex)
 {
     Console.WriteLine("Exception while getting devices from server");
     Console.WriteLine(ex);
     WarningMessage.Display("Could not refresh devices", "Exception while getting devices from server", this);
     // Show an empty list
     source.serverDevices = new List <List <Device> >();
     TableView.ReloadData();
 }
        public void Should_be_able_to_consume_warning_messages()
        {
            var consumer = new InformationMessageConsumer(_bus);
            var message  = new WarningMessage("some warning");

            _bus.Publish(message);
            waitForAsyncCall();
            consumer.WarningMessageEventWasCalled.ShouldBeTrue();
        }
 public vWarningMessage(WarningMessage message)
 {
     this.Id = message.Id;
     this.AccidentId = message.AccidentId;
     this.CreateDate = message.CreateDate;
     this.CreateId = message.CreateId;
     this.CreateUserName = message.CreateUser.Username;
     this.Message = message.Message;
 }
        private void ShowWarning(String warningMessage)
        {
            // Remove todos os controles da página
            configurationArea.Controls.Clear();
            controlArea.Controls.Clear();

            // Renderiza a mensagem na página
            WarningMessage.Show(controlArea, warningMessage);
        }
 public void RecievingWarningMessage(WarningMessage message)
 {
     _syncContext.Post(m =>
                           {
                               addToList(m);
                               if (MessageArrived != null)
                                   MessageArrived(this, new MessageRecievedEventArgs(MessageType.Warning));
                           }, message.Warning);
 }
Example #28
0
        public void MessageWarningMessageEmpty()
        {
            Message m_null = new WarningMessage(null);

            Assert.AreEqual(Message.MSG_NOT_DEFINED, m_null.Text);

            Message m_empty = new WarningMessage("");

            Assert.AreEqual(Message.MSG_NOT_DEFINED, m_empty.Text);
        }
Example #29
0
        public void AddWarning(string message, string code = null)
        {
            WarningMessage.Add(message);

            Warnings.Add(new RtEventDetails()
            {
                Code    = code ?? "warning",
                Message = message
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Rectangular cell displaying the label and inputfield
            UIView rectangle = new UIView(new CGRect(0, 90, View.Bounds.Width, 50));

            rectangle.BackgroundColor = UIColor.White;
            View.AddSubview(rectangle);

            // Label
            UILabel newName = new UILabel();

            newName.Text  = "New name:";
            newName.Frame = new CGRect(15, 10, 100, 31);
            rectangle.AddSubview(newName);

            // Inputfield
            UITextField changeNameField = new UITextField();

            changeNameField.Frame       = new CGRect(110, 10, View.Bounds.Width - 125, 31);
            changeNameField.Placeholder = device.Name;
            rectangle.AddSubview(changeNameField);

            View.BackgroundColor = Globals.DefaultLightGray;
            Title = device.Name;

            // Save button
            saveName = new UIBarButtonItem(UIBarButtonSystemItem.Save, (s, e) => {
                if (changeNameField.Text.Length <= 0)
                {
                    WarningMessage.Display("Error", "You have to give a name for the device.", this);
                }
                else
                {
                    try
                    {
                        device.Name = changeNameField.Text;
                        // Reset editing mode to be able to correctly update cell contents
                        owner.CancelEditingState();

                        owner.RefreshDeviceList();
                        owner.SetEditingState();
                        NavigationController.PopViewController(true);
                    }
                    catch (ServerInteractionException ex)
                    {
                        Console.WriteLine("Exception while changing device name");
                        Console.WriteLine(ex);
                        WarningMessage.Display("Exception", "An exception occurred on the server when changing the name of the device", this);
                    }
                }
            });
            NavigationItem.RightBarButtonItem = saveName;
        }
 public void RecievingWarningMessage(WarningMessage message)
 {
     _syncContext.Post(m =>
     {
         addToList(m);
         if (MessageArrived != null)
         {
             MessageArrived(this, new MessageRecievedEventArgs(MessageType.Warning));
         }
     }, message.Warning);
 }
Example #32
0
        public void ReloadButtons(bool isEditing)
        {
            RemoveButtons();
            // Voice control / add device button
            UIButton button = new UIButton(UIButtonType.System);

            button.Frame = new CGRect(TableView.Bounds.Width - IconDimension - Padding, bottomOfView - TableViewFooterHeight - Padding, IconDimension, IconDimension);
            if (isEditing)
            {
                button.SetBackgroundImage(UIImage.FromBundle(strings.addDeviceIcon), UIControlState.Normal);
            }
            else
            {
                button.SetBackgroundImage(UIImage.FromBundle(strings.voiceControlIcon), UIControlState.Normal);
            }

            button.TouchDown += (object sender, EventArgs e) =>
            {
                if (!isEditing)
                {
                    speechRecognizer = new SpeechRecognition(this);
                    speechRecognizer.StartRecording(out int warningStatus);
                    if (warningStatus == (int)Warning.AccessDenied) // Access to speech recognition denied
                    {
                        WarningMessage.Display(strings.speechAccessDenied, strings.speechAllowAccess, this);
                    }
                    else if (warningStatus == (int)Warning.RecordProblem) // Couldn't start speech recording
                    {
                        WarningMessage.Display(strings.speechStartRecordProblem, strings.tryAgain, this);
                    }
                }
            };

            button.TouchUpInside += (object sender, EventArgs e) =>
            {
                if (isEditing)
                {   // segue to add device
                    ((TableSourceDevicesMain)DevicesTable.Source).InsertAction();
                }
                else
                {
                    speechRecognizer.StopRecording();
                }
            };

            button.TouchDragExit += (object sender, EventArgs e) =>
            {
                if (!isEditing)
                {
                    speechRecognizer.CancelRecording();
                }
            };
            ParentViewController.View.AddSubview(button);
        }
Example #33
0
	private void DetectDevice(out WarningMessage? msg) {
		HMDFlag = OVRDevice.IsHMDPresent();
		//检测HeadSensor是否连接(SensorIndex=0),其他SensorIndex目前暂未使用(见Oculus官方注释,当前SDK版本SDK1)
		sensorFlag = OVRDevice.IsSensorPresent(0);
		if (!HMDFlag) {
			msg = messages.Find(m => m.msgName == "HMD Non-Attached");
			return;
		}
		if (!sensorFlag) {
			msg = messages.Find(m => m.msgName == "Sensor Non-Detected");
			return;
		}
		msg = null;
	}
Example #34
0
	private void LoadXML() {
		XmlDocument xmlFile = new XmlDocument();
		xmlFile.LoadXml(warningMsgFile.text);
		XmlNodeList msgList = xmlFile.GetElementsByTagName("msg");
		foreach (XmlNode msg in msgList) {
			WarningMessage warning = new WarningMessage();
			warning.msgName = msg.Attributes["name"].Value;
			warning.msgText = new List<string>();
			XmlNodeList textList = msg.ChildNodes;
			foreach (XmlNode text in textList)
				warning.msgText.Add(text.InnerText);
			messages.Add(warning);
		}
	}
Example #35
0
    /// <summary>
    /// Odchyceni vyjimek typu WSException a odeslani klientovi kod: 400 Bad Request + JSON s popisem chyby

    /// </summary>
    /// <param name="context"></param>
    public override void OnException(HttpActionExecutedContext context)
    {
        // jedna se o vyjimku vyvolanou pri testovani claims
        if (context.Exception.GetType().Name == "SecurityException")
        {
            throw new HttpResponseException(context.Request.CreateResponse(HttpStatusCode.Unauthorized));
        }

        if (context.Exception.Message == "Forbidden")
        {
            throw new HttpResponseException(context.Request.CreateResponse(HttpStatusCode.Forbidden, new ErrorMessage() { Message = context.Exception.InnerException.Message }));
        }

        if (context.Exception.Message == "Warning")
        {
            string status = (context.Exception.Data["status"] != null) ? context.Exception.Data["status"].ToString() : string.Empty;
            WarningMessage warningMessage = new WarningMessage() { Status = status, Message = context.Exception.InnerException.Message };
            throw new HttpResponseException(context.Request.CreateResponse(HttpStatusCode.OK, warningMessage));
        }
        

    }
Example #36
0
	public void DisplayMsg(WarningMessage msg) {
		int index = 0;
		foreach (string text in msg.msgText) {
			messageDisplay[index++].text = text;
			if (index >= messageDisplay.Length)
				return;
		}
	}
Example #37
0
 public WarningMessageEventArgs(WarningMessage message)
 {
     Message = message;
 }
 public void RecievingWarningMessage(WarningMessage message)
 {
     _warningMessage = message;
 }
 public void RecievingWarningMessage(WarningMessage message)
 {
     _logger.Warn(message.Warning);
 }
Example #40
0
 public void RecievingWarningMessage(WarningMessage message)
 {
     listViewInformation.Items.Add(message.Warning);
 }
Example #41
0
        public void Format_MessageIsWarning_InfoIsWrittenAfterDateInMessage()
        {
            var timeService = new FakeTimeService();
            var current = new DateTime(2012, 08, 28, 12, 0, 0);
            timeService.CurrentDateTime = current;
            var message = new WarningMessage();
            var formatter = new LogFormater(timeService);

            var formattedMessage = formatter.Format(message);

            Assert.IsTrue(formattedMessage.StartsWith("[28.08.2012 12:00][Warning]"));
        }
Example #42
0
 public void Should_be_able_to_consume_warning_messages()
 {
     var consumer = new InformationMessageConsumer(_bus);
     var message = new WarningMessage("some warning");
     _bus.Publish(message);
     waitForAsyncCall();
     consumer.WarningMessageEventWasCalled.ShouldBeTrue();
 }