Example #1
0
 protected void lbDeleteSelected_Click(object sender, EventArgs e)
 {
     if ((_selectionFilter != null) && (_selectionFilter.Values != null))
     {
         if (!_inverseSelection)
         {
             foreach (var id in _selectionFilter.Values)
             {
                 VoiceService.DeleteTheme(SQLDataHelper.GetInt(id));
             }
         }
         else
         {
             var itemsIds = _paging.ItemsIds <int>("VoiceThemeID as ID");
             foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString())))
             {
                 VoiceService.DeleteTheme(id);
             }
         }
     }
 }
Example #2
0
        public RoomView(ChatView parent, ChatService chat, ChatRoom room)
        {
            InitializeComponent();

            ParentView = parent;
            Chat       = chat;
            Room       = room;

            Core      = chat.Core;
            Locations = Core.Locations;

            GuiUtils.SetupToolstrip(BottomStrip, new OpusColorTable());

            if (room.Kind == RoomKind.Command_High || room.Kind == RoomKind.Live_High)
            {
                MessageTextBox.BackColor = Color.FromArgb(255, 250, 250);
            }

            else if (room.Kind == RoomKind.Command_Low || room.Kind == RoomKind.Live_Low)
            {
                MessageTextBox.BackColor = Color.FromArgb(250, 250, 255);
            }

            MemberTree.PreventCollapse = true;

            MessageTextBox.Core = Core;
            MessageTextBox.ContextMenuStrip.Items.Insert(0, new ToolStripSeparator());

            TimestampMenu = new ToolStripMenuItem("Timestamps", ViewRes.timestamp, new EventHandler(Menu_Timestamps));
            MessageTextBox.ContextMenuStrip.Items.Insert(0, TimestampMenu);


            VoiceService voices = Core.GetService(ServiceIDs.Voice) as VoiceService;

            if (voices != null)
            {
                VoiceButton = new VoiceToolstripButton(voices);
                BottomStrip.Items.Add(VoiceButton);
            }
        }
Example #3
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            var theme = VoiceService.GetTopTheme();

            if (theme == null || theme.Answers == null || !theme.Answers.Any() || !theme.IsDefault)
            {
                Visible = false;
                return;
            }
            try
            {
                if (Request.Browser.Cookies && Request.Cookies[_cookieCollectionNameVoting] == null)
                {
                    CommonHelper.SetCookieCollection(_cookieCollectionNameVoting, new NameValueCollection(), new TimeSpan(365, 0, 0, 0));
                }
            }

            catch (Exception ex)
            {
                Debug.LogError(ex);
            }
        }
Example #4
0
        public override void Init()
        {
            InputControl.SendMessage += new TextInput.SendMessageHandler(InputControl_SendMessage);
            InputControl.SendFile    += new MethodInvoker(InputControl_SendFile);
            InputControl.IgnoreUser  += new MethodInvoker(InputControl_IgnoreUser);
            InputControl.AddBuddy    += new MethodInvoker(InputControl_AddBuddy);

            IM.ReSearchUser(UserID);
            IM_StatusUpdate(UserID);
            DisplayLog();

            InputControl.InputBox.Select();

            if (External != null)
            {
                External.Activated  += new EventHandler(External_Activated);
                External.Deactivate += new EventHandler(External_Deactivate);
            }

            if (!Core.Buddies.BuddyList.SafeContainsKey(UserID))
            {
                InputControl.AddBuddyButton.Visible = true;
            }


            VoiceService voices = Core.GetService(ServiceIDs.Voice) as VoiceService;

            if (voices != null)
            {
                VoiceButton = new VoiceToolstripButton(voices);
                InputControl.FontToolStrip.Items.Add(VoiceButton);
                VoiceButton.SetUsers(new List <ulong>()
                {
                    Core.UserID, UserID
                }, AudioDirection.Both);
            }
        }
Example #5
0
    protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteTheme")
        {
            VoiceService.DeleteTheme(Convert.ToInt32(e.CommandArgument));
        }

        if (e.CommandName == "AddTheme")
        {
            //TODO validate input
            try
            {
                VoiceService.AddTheme(new VoiceTheme
                {
                    Name      = ((TextBox)grid.FooterRow.FindControl("txtNewName")).Text,
                    IsDefault =
                        ((CheckBox)grid.FooterRow.FindControl("chkNewIsDefault")).Checked,
                    IsHaveNullVoice =
                        ((CheckBox)grid.FooterRow.FindControl("chkNewIsHaveNullVoice")).
                        Checked,
                    IsClose =
                        ((CheckBox)grid.FooterRow.FindControl("chkNewIsClose")).Checked
                });
                grid.ShowFooter = false;
            }
            catch (Exception ex)
            {
                MsgErr(ex.Message);
            }
        }


        if (e.CommandName == "CancelAdd")
        {
            grid.ShowFooter = false;
        }
    }
Example #6
0
        protected override void OnActivated(IActivatedEventArgs e)
        {
            base.OnActivated(e);

            if (e.Kind == ActivationKind.VoiceCommand)
            {
                var commandArgs = e as VoiceCommandActivatedEventArgs;

                Scenario scenario = VoiceService.GetScenarioFromInput(commandArgs);

                Frame rootFrame = Window.Current.Content as Frame;
                if (rootFrame != null)
                {
                    if (scenario != null)
                    {
                        rootFrame.Navigate(typeof(ActionPage), scenario);
                    }
                    else
                    {
                        rootFrame.Navigate(typeof(MainPage));
                    }
                }
            }
        }
Example #7
0
 private void SetWit(VoiceService wit)
 {
     if (HasWit)
     {
         wit.events.OnRequestCreated.RemoveListener(OnRequestCreated);
         wit.events.OnError.RemoveListener(OnError);
         wit.events.OnResponse.RemoveListener(ShowResponse);
         wit.events.OnFullTranscription.RemoveListener(ShowTranscription);
         wit.events.OnPartialTranscription.RemoveListener(ShowTranscription);
     }
     if (null != wit)
     {
         this.wit = wit;
         wit.events.OnRequestCreated.AddListener(OnRequestCreated);
         wit.events.OnError.AddListener(OnError);
         wit.events.OnResponse.AddListener(ShowResponse);
         wit.events.OnFullTranscription.AddListener(ShowTranscription);
         wit.events.OnPartialTranscription.AddListener(ShowTranscription);
         // We will be measuring perceived request time since the actual request starts
         // as soon as the mic goes active and the user says something.
         wit.events.OnStoppedListening.AddListener(ResetStartTime);
         Repaint();
     }
 }
Example #8
0
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddLogging(
                builder => builder
                .AddConsole(options => options.DisableColors = false)
                .SetMinimumLevel(LogLevel.Debug));

            var serviceProvider = serviceCollection.BuildServiceProvider();
            var loggerFactory   = serviceProvider.GetService <ILoggerFactory>();


            string   addr, name, pass;
            int      port;
            FileInfo serverConfigFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, "server.txt"));

            if (serverConfigFile.Exists)
            {
                using (StreamReader reader = new StreamReader(serverConfigFile.OpenRead()))
                {
                    addr = reader.ReadLine();
                    port = int.Parse(reader.ReadLine());
                    name = reader.ReadLine();
                    pass = reader.ReadLine();
                }
            }
            else
            {
                Console.WriteLine("Enter server address:");
                addr = Console.ReadLine();
                Console.WriteLine("Enter server port (leave blank for default (64738)):");
                string line = Console.ReadLine();
                if (line == "")
                {
                    port = 64738;
                }
                else
                {
                    port = int.Parse(line);
                }
                Console.WriteLine("Enter name:");
                name = Console.ReadLine();
                Console.WriteLine("Enter password:"******"ChannelMsg: {eventArgs.Message.Text}");
            tms.PersonalMessageReceived += (sender, eventArgs) => Console.WriteLine($"PersonalMsg: {eventArgs.Message.Text}");

            connection.Connect(name, pass, new string[0], addr, ValidateCertificate, SelectCertificate);

            while (!serverStateService.ReceivedServerSync)
            {
                Thread.Sleep(5000);
            }
            recorder.StartCapture();

            Console.ReadLine();
        }
Example #9
0
 public MusicListCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #10
0
 public DisconnectVoice(VoiceService voice)
 {
     this._voice = voice;
 }
Example #11
0
 public PauseMusicCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #12
0
 public VoteSkipMusicCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #13
0
 public VoiceModule(VoiceService service)
 {
     _service = service;
 }
Example #14
0
 public ClearMusicQueueCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #15
0
 public SkipCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #16
0
        protected override void LayoutContent()
        {
            // Get service
            VoiceService voiceService = null;

            // Runtime Mode
            if (Application.isPlaying)
            {
                // Refresh services
                if (_services == null)
                {
                    RefreshVoiceServices();
                }
                // Services missing
                if (_services == null || _serviceNames == null || _services.Length == 0)
                {
                    WitEditorUI.LayoutErrorLabel(WitTexts.Texts.UnderstandingViewerMissingServicesLabel);
                    return;
                }
                // Voice service select
                int  newService    = _currentService;
                bool serviceUpdate = false;
                GUILayout.BeginHorizontal();
                // Clamp
                if (newService < 0 || newService >= _services.Length)
                {
                    newService    = 0;
                    serviceUpdate = true;
                }
                // Layout
                WitEditorUI.LayoutPopup(WitTexts.Texts.UnderstandingViewerServicesLabel, _serviceNames, ref newService, ref serviceUpdate);
                // Update
                if (serviceUpdate)
                {
                    SetVoiceService(newService);
                }
                // Refresh
                if (WitEditorUI.LayoutTextButton(WitTexts.Texts.ConfigurationRefreshButtonLabel))
                {
                    RefreshVoiceServices();
                }
                GUILayout.EndHorizontal();
                // Ensure service exists
                voiceService = service;
            }
            // Editor Only
            else
            {
                // Configuration select
                base.LayoutContent();
                // Ensure configuration exists
                if (!witConfiguration)
                {
                    WitEditorUI.LayoutErrorLabel(WitTexts.Texts.UnderstandingViewerMissingConfigLabel);
                    return;
                }
                // Check client access token
                string clientAccessToken = witConfiguration.clientAccessToken;
                if (string.IsNullOrEmpty(clientAccessToken))
                {
                    WitEditorUI.LayoutErrorLabel(WitTexts.Texts.UnderstandingViewerMissingClientTokenLabel);
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (WitEditorUI.LayoutTextButton(WitTexts.Texts.UnderstandingViewerSettingsButtonLabel))
                    {
                        Selection.activeObject = witConfiguration;
                    }
                    GUILayout.EndHorizontal();
                    return;
                }
            }

            // Determine if input is allowed
            bool allowInput = !Application.isPlaying || (service != null && !service.Active);

            GUI.enabled = allowInput;

            // Utterance field
            bool updated = false;

            WitEditorUI.LayoutTextField(new GUIContent(WitTexts.Texts.UnderstandingViewerUtteranceLabel), ref _utterance, ref updated);

            // Begin Buttons
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            // Submit utterance
            if (allowInput && WitEditorUI.LayoutTextButton(WitTexts.Texts.UnderstandingViewerSubmitButtonLabel))
            {
                _responseText = "";
                if (!string.IsNullOrEmpty(_utterance))
                {
                    SubmitUtterance();
                }
                else
                {
                    _response = null;
                }
            }

            // Service buttons
            GUI.enabled = true;
            if (EditorApplication.isPlaying && voiceService)
            {
                if (!voiceService.Active)
                {
                    // Activate
                    if (WitEditorUI.LayoutTextButton(WitTexts.Texts.UnderstandingViewerActivateButtonLabel))
                    {
                        voiceService.Activate();
                    }
                }
                else
                {
                    // Deactivate
                    if (WitEditorUI.LayoutTextButton(WitTexts.Texts.UnderstandingViewerDeactivateButtonLabel))
                    {
                        voiceService.Deactivate();
                    }
                    // Abort
                    if (WitEditorUI.LayoutTextButton(WitTexts.Texts.UnderstandingViewerAbortButtonLabel))
                    {
                        voiceService.DeactivateAndAbortRequest();
                    }
                }
            }
            GUILayout.EndHorizontal();

            // Results
            GUILayout.BeginVertical(EditorStyles.helpBox);
            if (_response != null)
            {
                DrawResponse();
            }
            else if (voiceService && voiceService.MicActive)
            {
                WitEditorUI.LayoutWrapLabel(WitTexts.Texts.UnderstandingViewerListeningLabel);
            }
            else if (voiceService && voiceService.IsRequestActive)
            {
                WitEditorUI.LayoutWrapLabel(WitTexts.Texts.UnderstandingViewerLoadingLabel);
            }
            else if (string.IsNullOrEmpty(_responseText))
            {
                WitEditorUI.LayoutWrapLabel(WitTexts.Texts.UnderstandingViewerPromptLabel);
            }
            else
            {
                WitEditorUI.LayoutWrapLabel(_responseText);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
Example #17
0
 public SkipToMusicCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #18
0
        public SetMusicHostCommand(VoiceService voice)
        {
			this._voice = voice;
        }
Example #19
0
 public MusicChannelCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #20
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (grid.UpdatedRow != null)
        {
            try
            {
                int countVoices = 0;
                int sort        = 0;
                if (Int32.TryParse(grid.UpdatedRow["CountVoice"], out countVoices) && Int32.TryParse(grid.UpdatedRow["Sort"], out sort))
                {
                    var answer = new Answer
                    {
                        AnswerId   = Convert.ToInt32(grid.UpdatedRow["ID"]),
                        Name       = grid.UpdatedRow["Name"],
                        IsVisible  = Convert.ToBoolean(grid.UpdatedRow["IsVisible"]),
                        FkidTheme  = ThemeId,
                        CountVoice = countVoices,
                        Sort       = sort
                    };
                    VoiceService.UpdateAnswer(answer);
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }
        }

        DataTable data = _paging.PageItems;

        while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
        {
            _paging.CurrentPageIndex--;
            data = _paging.PageItems;
        }

        data.Columns.Add(new DataColumn("IsSelected", typeof(bool))
        {
            DefaultValue = _inverseSelection
        });
        if ((_selectionFilter != null) && (_selectionFilter.Values != null))
        {
            for (int i = 0; i <= data.Rows.Count - 1; i++)
            {
                int intIndex = i;
                if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                {
                    data.Rows[i]["IsSelected"] = !_inverseSelection;
                }
            }
        }

        if (data.Rows.Count < 1)
        {
            goToPage.Visible = false;
        }

        grid.DataSource = data;
        grid.DataBind();

        pageNumberer.PageCount = _paging.PageCount;
        lblFound.Text          = _paging.TotalRowsCount.ToString();
    }
Example #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["theme"] == null)
        {
            Response.Redirect("Voting.aspx");
        }
        lblHead.Text = VoiceService.GetVotingName(ThemeId);
        Page.Title   = string.Format("{0} - {1} - {2}", SettingsMain.ShopName, lblHead.Text, lblSubHead.Text);

        if (!IsPostBack)
        {
            _paging = new SqlPaging
            {
                TableName    = "[Voice].[Answer]",
                ItemsPerPage = 10
            };

            _paging.AddFieldsRange(new List <Field>
            {
                new Field {
                    Name = "AnswerID as ID", IsDistinct = true
                },
                new Field {
                    Name = "Name"
                },
                new Field {
                    Name = "CountVoice"
                },
                new Field {
                    Name = "Sort", Sorting = SortDirection.Ascending
                },
                new Field {
                    Name = "IsVisible"
                },
                new Field {
                    Name = "DateAdded"
                },
                new Field {
                    Name = "DateModify"
                },
                new Field
                {
                    Name   = "FKIDTheme",
                    Filter = new EqualFieldFilter {
                        ParamName = "@Theme", Value = ThemeId.ToString()
                    }
                }
            });

            grid.ChangeHeaderImageUrl("arrowSort", "images/arrowup.gif");

            _paging.ItemsPerPage = 10;

            pageNumberer.CurrentPageIndex = 1;
            _paging.CurrentPageIndex      = 1;
            ViewState["Paging"]           = _paging;
        }
        else
        {
            _paging = (SqlPaging)(ViewState["Paging"]);
            _paging.ItemsPerPage = Convert.ToInt32(ddRowsPerPage.SelectedValue);

            if (_paging == null)
            {
                throw (new Exception("Paging lost"));
            }

            string strIds = Request.Form["SelectedIds"];

            if (!string.IsNullOrEmpty(strIds))
            {
                strIds = strIds.Trim();
                string[] arrids = strIds.Split(' ');

                _selectionFilter = new InSetFieldFilter();
                if (arrids.Contains("-1"))
                {
                    _selectionFilter.IncludeValues = false;
                    _inverseSelection = true;
                }
                else
                {
                    _selectionFilter.IncludeValues = true;
                }
                _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
            }
        }
    }
Example #22
0
 public BingoCommand(MusicBingoService bingo, VoiceService voice)
 {
     this._bingo = bingo;
     this._voice = voice;
 }
Example #23
0
        public HttpResponseMessage getProfInformation(int letterForProf, int?profession = null, int?area = null, int?city = null)
        {
            if (city != null)
            {
                return(new HttpResponseMessage()
                {
                    Content = new StringContent("read=t-" + VoiceService.selectedRecommended((int)letterForProf, (int)profession, (int)area, (int)city) + ".s-005=city,no,2,1,5,no,,,,,3",
                                                Encoding.UTF8, "text/plain")
                });
            }

            if (area != null)
            {
                return(new HttpResponseMessage()
                {
                    Content = new StringContent("read=t-" + VoiceService.selectedCities((int)area) + ".s-004=city,no,1,1,5,no,,,,,3",
                                                Encoding.UTF8, "text/plain")
                });
            }
            if (profession != null)
            {
                return(new HttpResponseMessage()
                {
                    Content = new StringContent("read=t-" + VoiceService.selectedAreas() + ".s-003=area,no,1,1,5,no,,,,,3",
                                                Encoding.UTF8, "text/plain")
                });
            }
            return(new HttpResponseMessage()
            {
                Content = new StringContent("read=t-" + VoiceService.SelectedProfByLetters(VoiceService.SelectedLetters(letterForProf)) + ".s-002=profession,no,2,1,5,no,,,,",
                                            Encoding.UTF8, "text/plain")
            });
        }
Example #24
0
 public ResumeMusicCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #25
0
        private void button3_Click(object sender, EventArgs e)
        {
            VoiceService service = Service.Factory.ServicesFactory.GetInstance().GetVoicService();

            service.BroadcastOnce("习近平表示,尊敬的菲德尔同志,很高兴再次同你见面。2011年我访问古巴时拜访了你,我们进行了长时间交谈。今天看到你精神矍铄,我感到十分欣慰");
        }
Example #26
0
 public PlayCommand(VoiceService voice)
 {
     this._voice = voice;
 }
Example #27
0
 public void Run()
 {
     VoiceService.Beep();
     VoiceService.Speak("我爱你  i love you 1234");
 }
Example #28
0
 public VoiceService GetVoicService()
 {
     voiceService = new VoiceServiceImpl();
     //voiceService = new VoiceServiceImplByDotNetSpeech();
     return(voiceService);
 }