コード例 #1
0
        private async void ApplyTheme()
        {
            //show warning for notebook on battery with enabled battery saver
            if (PowerManager.EnergySaverStatus == EnergySaverStatus.On)
            {
                userFeedback.Text     = Properties.Resources.msgChangesSaved + "\n\n" + Properties.Resources.msgBatterySaver;
                applyButton.IsEnabled = true;
            }
            else
            {
                userFeedback.Text = Properties.Resources.msgChangesSaved;//changes were saved!
            }

            if (builder.Config.Location.Enabled)
            {
                ActivateLocationMode();
            }
            else
            {
                try
                {
                    builder.Save();
                }
                catch (Exception ex)
                {
                    ShowErrorMessage(ex);
                }
            }
            try
            {
                string result = await messagingClient.SendMesssageAndGetReplyAsync(Command.Switch);

                if (result == Command.Err)
                {
                    throw new SwitchThemeException();
                }
            }
            catch (Exception ex)
            {
                ErrorWhileApplyingTheme($"ZMQ message is {Command.Err}", ex.ToString());
            }
        }
コード例 #2
0
        private async void RequestThemeSwitch()
        {
            try
            {
                string result = await messagingClient.SendMesssageAndGetReplyAsync(Command.Switch);

                if (result == Command.Err)
                {
                    throw new SwitchThemeException();
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
        }
コード例 #3
0
        private async void RequestThemeSwitch()
        {
            string result = Command.Err;

            try
            {
                result = await messagingClient.SendMesssageAndGetReplyAsync(Command.Switch);

                if (result != Command.Ok)
                {
                    throw new SwitchThemeException();
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage($"ZeroMQ returned err {result}", ex);
            }
        }