Beispiel #1
0
        private void numberMark_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(((System.Windows.Controls.TextBox)sender).Text))
                {
                    numberMark.Opacity     = 0.8;
                    m_strPreviousText      = "";
                    this.button1.IsEnabled = false;
                }
                else
                {
                    int  num     = 0;
                    bool success = int.TryParse(((System.Windows.Controls.TextBox)sender).Text, out num);
                    if (success & num > 0 && num <= 5)
                    {
                        ((System.Windows.Controls.TextBox)sender).Text.Trim();
                        m_strPreviousText = ((System.Windows.Controls.TextBox)sender).Text;
                    }
                    else
                    {
                        ((System.Windows.Controls.TextBox)sender).Text           = m_strPreviousText;
                        ((System.Windows.Controls.TextBox)sender).SelectionStart = ((System.Windows.Controls.TextBox)sender).Text.Length;
                    }

                    numberMark.Opacity     = 1;
                    this.button1.IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #2
0
        // 2013-12-30: GreenRose
        public void TitleDownloadComplete(string filePath)
        {
            try
            {
                string      strImagePath = filePath;
                BitmapImage bi           = new BitmapImage();

                bi.BeginInit();
                bi.UriSource = new Uri(strImagePath, UriKind.RelativeOrAbsolute);
                bi.EndInit();

                var faceGrid = new Grid();
                faceGrid.Width  = 82;
                faceGrid.Height = 81;
                faceGrid.Margin = new Thickness(0);

                Image finalImage = new Image();
                finalImage.Cursor             = System.Windows.Input.Cursors.Hand;
                finalImage.Margin             = new Thickness(2, 1, 2, 1);
                finalImage.DataContext        = filePath;
                finalImage.Source             = bi;
                finalImage.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(videoImg_MouseDown);
                faceGrid.Children.Add(finalImage);
                wrapPanel1.Children.Add(faceGrid);
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
        public void PictureDownloadComplete(string filePath)
        {
            try
            {
                //복호화한다. 2014-2-25 by pakcj
                //string decPath = WebDownloader.GetInstance().DecryptFile(filePath);
                string decPath = filePath;

                string      strImagePath = decPath;
                BitmapImage bi           = new BitmapImage();

                bi.BeginInit();
                bi.UriSource   = new Uri(strImagePath, UriKind.RelativeOrAbsolute);
                bi.CacheOption = BitmapCacheOption.OnLoad;
                bi.EndInit();

                System.Windows.Controls.Image _image = new Image();
                _image.Source = bi;

                stackPanel1.Children.Add(_image);
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #4
0
        private void Each_Tick(Object obj, EventArgs ev)
        {
            try
            {
                if (_nStep + 1 == m_classTypeListInfo.ClassType.Count)
                {
                    disapthcerTimer.Stop();
                }

                if ((m_classTypeListInfo.ClassType[_nStep].Class_File_Type == 2 || m_classTypeListInfo.ClassType[_nStep].Class_File_Type == 0) && !_bSuccess)
                {
                    _bSuccess = true;

                    Login._ClassTypeInfo = m_classTypeListInfo.ClassType[_nStep];
                    FilmUserControl filmUserControl = new FilmUserControl();

                    wrapPanel1.Children.Add(filmUserControl);
                    filmUserControl.InitFilmView(Login._ClassTypeInfo);

                    _nStep++;
                    _bSuccess = false;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #5
0
        private void Window_Closed(object sender, EventArgs e)
        {
            try
            {
                //if (localWebCam != null)
                //{
                //    if (localWebCam.IsRunning)
                //        localWebCam.Stop();
                //}

                if (disapthcerTimer != null)
                {
                    disapthcerTimer.IsEnabled = false;
                }

                AnyChatCoreSDK.LeaveRoom(-1);
                AnyChatCoreSDK.Logout();
                AnyChatCoreSDK.Release();

                //if (_writer != null)
                //    _writer.Close();

                Main.videoCreat = null;
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #6
0
        private void Each_Tick(Object obj, EventArgs ev)
        {
            try
            {
                //if (firstcapture == true)
                //{
                //    var encoder = new BmpBitmapEncoder();
                //    RenderTargetBitmap bitmap = new RenderTargetBitmap(320, 240, 96, 96, PixelFormats.Pbgra32);
                //    bitmap.Render(cameraImg);
                //    BitmapFrame frame = BitmapFrame.Create(bitmap);
                //    encoder.Frames.Add(frame);

                //    using (var stream = File.Create(_strRecordFilePath.Replace(".avi", ".gif")))
                //    {
                //        encoder.Save(stream);
                //    }
                //    firstcapture = false;
                //}


                //_writer.WriteVideoFrame(_bitmap);
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #7
0
        public void StartProc()
        {
            string path = System.Windows.Forms.Application.StartupPath + "\\Record\\";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                file.Delete();
            }

            try
            {
                //_writer = new VideoFileWriter();

                //_strRecordFilePath = path + Login._UserInfo.Id + System.DateTime.Now.ToString("yyyyMMddHHmm") + ".avi";
                //_writer.Open(_strRecordFilePath, 640, 480, 25, VideoCodec.MPEG4);

                //StartVideCapture();

                _strFileName = System.DateTime.Now.ToString("yyyyMMddHHmm");
                AnyChatCoreSDK.StreamRecordCtrl(-1, true, 0, 0);
                AnyChatCoreSDK.SnapShot(-1, 0, 0);
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #8
0
        // 2013-12-29: GreenRose
        private bool UpdateFile(string strFileName)
        {
            try
            {
                string strUri = Login._ServerPath;
                if (strUri[strUri.Length - 1] != '/')
                {
                    strUri = strUri + "/";
                }

                strUri += "FaceUpload.php";

                System.Net.WebClient wc = new System.Net.WebClient();
                wc.Credentials = System.Net.CredentialCache.DefaultCredentials;
                wc.UploadFile(strUri, strFileName);
                wc.Dispose();
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);

                return(false);
            }

            return(true);
        }
        private void DownloadAsync(GameDownloadInfo newInfo)
        {
            _Client = null;

            GameDownloadInfo downloadInfo = newInfo;

            string exePath   = System.Windows.Forms.Application.StartupPath + "\\";
            string localPath = exePath + downloadInfo._filePath.Replace('/', '\\');

            if (File.Exists(localPath) == true)
            {
                try
                {
                    File.Delete(localPath);
                }
                catch (Exception ex)
                {
                    string strError = ex.ToString();
                    ErrorCollection.GetInstance().SetErrorInfo(strError);
                }
            }

            string[] folderNames = localPath.Split('\\');
            string   folderPath  = string.Empty;

            fileName = folderNames[folderNames.Length - 1];
            for (int i = 0; i < folderNames.Length - 1; i++)
            {
                folderPath += folderNames[i];

                if (Directory.Exists(folderPath) == false)
                {
                    Directory.CreateDirectory(folderPath);
                }

                folderPath += '\\';
            }

            _Client       = new WebClient();
            _Client.Proxy = null;

            _Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            _Client.DownloadFileCompleted   += DownloadFileCompleted(localPath, downloadInfo);

            var url = Login._ServerGamePath + downloadInfo._filePath;

            //System.Threading.Thread.Sleep(1000);
            _Client.DownloadFileAsync(new Uri(url), localPath);

            //_ProgressBarWindow.Show();
            //_ProgressBarWindow.Left = downloadInfo._window.Left + downloadInfo._window.Width / 2;
            //_ProgressBarWindow.Top = downloadInfo._window.Top + downloadInfo._window.Height / 2;

            return;

            //_ProgressBarWindow.Hide();
        }
Beispiel #10
0
        public void OnAgree()
        {
            //this.toolStripLabel_msg.Text = "正在连接 . . .";

            //this.qqGlassButton3.Image = MakeGrayscale3((Bitmap)(resources.GetObject("qqGlassButton3.Image")));
            //bAudioSending = false;
            int nResult = StartVideoCapture(ChatClient.Main._nCameraIndex);

            if (nResult == 0)
            {
                IntPtr result   = GetLastErrorString();
                string strError = Marshal.PtrToStringAnsi(result);

                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }

            nResult = StartAudioCapture();
            if (nResult == 0)
            {
                IntPtr result   = GetLastErrorString();
                string strError = Marshal.PtrToStringAnsi(result);

                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }

            SetCaptureWindow(this.panelLocal.Handle);

            nResult = StartSend();
            if (nResult == 0)
            {
                IntPtr result   = GetLastErrorString();
                string strError = Marshal.PtrToStringAnsi(result);

                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }

            StringBuilder strFriendID = new StringBuilder(this.friendID);

            nResult = StartReceive(strFriendID, this.panelRemote.Handle);
            if (nResult == 0)
            {
                IntPtr result   = GetLastErrorString();
                string strError = Marshal.PtrToStringAnsi(result);

                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }

            //this.toolStripLabel_msg.Visible = false;
            //this.toolStripLabel_netstate.Visible = true;
            //this.toolStripButton_hideMyself.Visible = true;
            //this.toolStripButton_camera.Visible = true;
            //this.toolStripButton_microphone.Visible = true;
            //this.toolStripButton_speaker.Visible = true;
            //this.toolStripSeparator1.Visible = true;
            //this.timer1.Start();
        }
Beispiel #11
0
        // 2014-02-26: GreenRose
        // Connect to OMCS server
        private bool LoginOMCSServer()
        {
            try
            {
                string id  = Login._UserInfo.Id;
                string pwd = Login._UserInfo.Password;

                Login.multimediaManager.ChannelMode = ChannelMode.P2PChannelFirst;
                //multimediaManager.CameraDeviceIndex = int.Parse(ConfigurationManager.AppSettings["CameraIndex"]);
                //multimediaManager.MicrophoneDeviceIndex = int.Parse(ConfigurationManager.AppSettings["MicrophoneIndex"]);
                //multimediaManager.SpeakerIndex = int.Parse(ConfigurationManager.AppSettings["SpeakerIndex"]);
                //multimediaManager.CameraEncodeQuality = 3;
                //multimediaManager.CameraVideoSize = new System.Drawing.Size(320, 240); //Size(320, 240)


                List <CameraInformation> listCameraInfos = OMCS.Tools.Camera.GetCameras();
                if (listCameraInfos.Count > 0)
                {
                    Login.multimediaManager.CameraDeviceIndex = 0;
                    List <CameraCapability> listCameraCapability = OMCS.Tools.Camera.GetCameraCapability(0);

                    if (listCameraCapability.Count > 0)
                    {
                        //multimediaManager.CameraVideoSize = listCameraCapability[listCameraCapability.Count - 1].VideoSize;
                        //Login.multimediaManager.CameraVideoSize = listCameraCapability[listCameraCapability.Count - 1].VideoSize;
                    }
                }

                List <MicrophoneInformation> listMicInfos = OMCS.Tools.SoundDevice.GetMicrophones();
                if (listMicInfos.Count > 0)
                {
                    Login.multimediaManager.MicrophoneDeviceIndex = 0;
                }

                List <SpeakerInformation> listSpeakInfos = OMCS.Tools.SoundDevice.GetSpeakers();
                if (listSpeakInfos.Count > 0)
                {
                    Login.multimediaManager.SpeakerIndex = 0;
                }

                Login.multimediaManager.CameraEncodeQuality = 6;


                Login.multimediaManager.Initialize(id, "", ConfigurationManager.AppSettings["OmcsServerIP"], int.Parse(ConfigurationManager.AppSettings["OmcsServerPort"]));
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }

            return(true);
        }
Beispiel #12
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         //m_multiChatRoom.ShowWomanWebCam(m_iconfClient);
     }
     catch (Exception ex)
     {
         string strError = ex.ToString();
         ErrorCollection.GetInstance().SetErrorInfo(strError);
     }
 }
Beispiel #13
0
 protected override void OnStartup(StartupEventArgs e)
 {
     try
     {
         Login login = new Login();
         login.Show();
     }
     catch (Exception ex)
     {
         string strError = ex.ToString();
         ErrorCollection.GetInstance().SetErrorInfo(strError);
     }
 }
        public void selPictureList(UserDetailInfo user)
        {
            try
            {
                wrapPanel1.Children.Clear();

                nTotalCount = user.Faces.Count;

                if (user.Faces.Count == 0)
                {
                    this.titleName.Visibility = Visibility.Visible;
                    return;
                }

                for (int i = 0; i < user.Faces.Count; i++)
                {
                    //string video = user.Faces[i].Icon;
                    //char[] delimiterChars = { ':', '\\' };
                    //string[] words = video.Split(delimiterChars);
                    //int count = words.Length;

                    //if (words[count - 2].ToString() == "Face")
                    {
                        user.Faces[i].Icon = user.Faces[i].Icon.Replace("\\", "/");
                        WebDownloader.GetInstance().ctrlSelectAlbum = this;
                        progressUpdate.Visibility = Visibility.Visible;
                        WebDownloader.GetInstance().DownloadFile(user.Faces[i].Icon, TitleDownloadComplete, this);

                        //var faceGrid = new Grid();
                        //faceGrid.Width = 82;
                        //faceGrid.Height = 81;
                        //faceGrid.Margin = new Thickness(0);

                        //Image finalImage = new Image();
                        //finalImage.Cursor = Cursors.Hand;
                        //finalImage.Margin = new Thickness(2, 1, 2, 1);
                        //finalImage.DataContext = user.Faces[i].Icon;
                        //finalImage.Source = ImageDownloader.GetInstance().GetImage(user.Faces[i].Icon);
                        //finalImage.MouseLeftButtonUp += new MouseButtonEventHandler(finalImage_MouseLeftButtonUp);
                        //faceGrid.Children.Add(finalImage);
                        //wrapPanel1.Children.Add(faceGrid);
                    }
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #15
0
        private void messageEditBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Enter)
                {
                    if (messageEditBox.Text != string.Empty)
                    {
                        TextBlock userIdtxt = new TextBlock();
                        userIdtxt.Margin     = new Thickness(0);
                        userIdtxt.Text       = "[" + Login._UserInfo.Id + "]" + " " + DateTime.Now.ToString();
                        userIdtxt.Foreground = new SolidColorBrush(Colors.Red);

                        TextBlock contenttxt = new TextBlock();
                        contenttxt.Margin     = new Thickness(0);
                        contenttxt.Text       = messageEditBox.Text;
                        contenttxt.Background = new SolidColorBrush(Colors.LightSkyBlue);


                        if (Login._UserInfo.Kind == (int)UserKind.ServiceWoman)
                        {
                            stackPanel2.Children.Add(userIdtxt);
                            stackPanel2.Children.Add(contenttxt);
                        }
                        else
                        {
                            stackPanel1.Children.Add(userIdtxt);
                            stackPanel1.Children.Add(contenttxt);
                        }


                        Login._StringInfo.UserId = sendId;
                        Login._StringInfo.String = messageEditBox.Text;
                        Login._ClientEngine.Send(NotifyType.Request_Message, Login._StringInfo);

                        messageEditBox.Clear();
                    }
                }
                else if (Keyboard.Modifiers == ModifierKeys.Shift && e.Key == Key.Insert)
                {
                    e.Handled = true;
                    return;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
        void userGrid_MouseClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IInputElement element = e.MouseDevice.DirectlyOver;
                if (element != null && element is FrameworkElement)
                {
                    if (((FrameworkElement)element).Parent is Microsoft.Windows.Controls.DataGridCell)
                    {
                        var grid = sender as Microsoft.Windows.Controls.DataGrid;
                        if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1)
                        {
                            for (int i = 0; i < grid.Columns.Count; i++)
                            {
                                var item = new Microsoft.Windows.Controls.DataGridCellInfo(grid.Items[grid.SelectedIndex], grid.Columns[0]);
                                var col  = item.Column as Microsoft.Windows.Controls.DataGridColumn;
                                var fc   = col.GetCellContent(item.Item);

                                if (fc is CheckBox)
                                {
                                    CheckBox checkCell = (CheckBox)fc;
                                    if (checkCell != null && checkCell.IsChecked == false)
                                    {
                                        checkCell.IsChecked = true;
                                        var addItemId = (ChargeData)item.Item;
                                        selectUserNameList.Add(addItemId.id);
                                    }
                                    else if (checkCell != null && checkCell.IsChecked == true)
                                    {
                                        checkCell.IsChecked = false;
                                        var delItemId = (ChargeData)item.Item;
                                        selectUserNameList.Remove(delItemId.id);
                                    }
                                }
                            }
                            if (selectUserNameList.Count > 0)
                            {
                                button1.IsEnabled = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
 void item3_MouseUp(object sender, MouseButtonEventArgs e)
 {
     try
     {
         contentsGrid.Children.Clear();
         SelectLetterControl selectLetterControl = new SelectLetterControl();
         selectLetterControl.markInfo(selUserDetail);
         contentsGrid.Children.Add(selectLetterControl);
     }
     catch (Exception ex)
     {
         string strError = ex.ToString();
         ErrorCollection.GetInstance().SetErrorInfo(strError);
     }
 }
 void item4_MouseUp(object sender, MouseButtonEventArgs e)
 {
     try
     {
         contentsGrid.Children.Clear();
         PictureControl pictureControl = new PictureControl();
         pictureControl.button4.Visibility = Visibility.Hidden;
         pictureControl.InitVideoList(selUserDetail.Faces);
         contentsGrid.Children.Add(pictureControl);
     }
     catch (Exception ex)
     {
         string strError = ex.ToString();
         ErrorCollection.GetInstance().SetErrorInfo(strError);
     }
 }
Beispiel #19
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //ics.Visibility = Visibility.Visible;
                //m_iconfClient.ClearImage();

                //ics.Child = m_iconfClient;
                //m_iconfClient.Show();
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #20
0
        public static void FileExecute(string strFileName)
        {
            System.Diagnostics.Process          p  = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo pi = new System.Diagnostics.ProcessStartInfo();
            pi.UseShellExecute = true;
            pi.FileName        = strFileName;
            p.StartInfo        = pi;

            try
            {
                p.Start();
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #21
0
        public void InitVideoList(List <IconInfo> videoLsit)
        {
            if (videoLsit != null)
            {
                for (int i = 0; i < videoLsit.Count; i++)
                {
                    if (videoLsit[i].Icon.Contains(".mp4") == true)
                    {
                        try
                        {
                            //char[] delimiterChars = { '\\', '.' };
                            //string[] imgwords = videoLsit[i].Icon.Split(delimiterChars);
                            //int imgcount = imgwords.Length;
                            //string imgName = imgwords[imgcount - 2].ToString();

                            //Image videoImg = new Image();
                            //videoImg.Width = 85;
                            //videoImg.Height = 63;
                            //videoImg.Cursor = System.Windows.Input.Cursors.Hand;
                            //videoImg.Margin = new Thickness(2, 2, 2, 2);
                            //string fileName = "\\Videos\\" + imgName + ".gif";
                            //videoImg.Source = ImageDownloader.GetInstance().GetImage(fileName);
                            //videoImg.DataContext = videoLsit[i].Icon;
                            //videoImg.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(videoImg_MouseDown);
                            //videoImg.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(videoImg_MouseRightButtonDown);
                            //wrapPanel1.Children.Add(videoImg);

                            // 2013-12-30: GreenRose
                            videoLsit[i].Icon = videoLsit[i].Icon.Replace("\\", "/");
                            videoLsit[i].Icon = videoLsit[i].Icon.Replace(".mp4", ".jpg");
                            WebDownloader.GetInstance().DownloadFile(videoLsit[i].Icon, TitleDownloadComplete, this);
                            videoLsit[i].Icon = videoLsit[i].Icon.Replace(".jpg", ".mp4");
                        }
                        catch (Exception ex)
                        {
                            string strError = ex.ToString();
                            ErrorCollection.GetInstance().SetErrorInfo(strError);
                        }
                    }
                }
            }
        }
        public void TitleDownloadComplete(string filePath)
        {
            try
            {
                string      strImagePath = filePath;
                BitmapImage bi           = new BitmapImage();

                bi.BeginInit();
                bi.UriSource = new Uri(strImagePath, UriKind.RelativeOrAbsolute);
                bi.EndInit();

                var faceGrid = new Grid();
                faceGrid.Width  = 82;
                faceGrid.Height = 81;
                faceGrid.Margin = new Thickness(0);

                Image finalImage = new Image();
                finalImage.Cursor             = Cursors.Hand;
                finalImage.Margin             = new Thickness(2, 1, 2, 1);
                finalImage.DataContext        = filePath;
                finalImage.Source             = bi;
                finalImage.MouseLeftButtonUp += new MouseButtonEventHandler(finalImage_MouseLeftButtonUp);
                faceGrid.Children.Add(finalImage);
                wrapPanel1.Children.Add(faceGrid);


                nStep++;

                if (nStep == nTotalCount)
                {
                    progressUpdate.Visibility = Visibility.Hidden;
                    WebDownloader.GetInstance().ctrlSelectAlbum = null;

                    nStep = 0;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
        void finalImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                var    getIcon  = sender as Image;
                string iconName = getIcon.DataContext.ToString();

                if (Main.previewImage == null)
                {
                    Main.previewImage = new PreviewImage();
                }
                Main.previewImage.ViewImage(iconName);
                Main.previewImage.Show();
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #24
0
        // 2013-12-31: GreenRose
        private void StopRecTimer_Tick(Object obj, EventArgs ev)
        {
            try
            {
                _stopRecTimer.IsEnabled = false;

                start.IsEnabled   = true;
                stop.IsEnabled    = false;
                preview.IsEnabled = true;
                save.IsEnabled    = true;

                AnyChatCoreSDK.StreamRecordCtrl(-1, false, 0, 0);
                //disapthcerTimer.IsEnabled = false;
                //_writer.Close();
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #25
0
        private void rtxtMessageEdit_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            try
            {
                string strSendMessage = "";
                strSendMessage = InterpretMessage();

                if (strSendMessage.Length > 3000)
                {
                    //ShowErrorOrMessage(ManagerMessage.ERROR_MANY_CHAT);
                    e.Handled = true;
                    return;
                }

                if (e.Key == Key.Enter)
                {
                    if (strSendMessage != null && strSendMessage != string.Empty && strSendMessage != "\r\n")
                    {
                        SendMessage(strSendMessage);
                    }

                    TextRange textRange = new TextRange(rtxtMessageEdit.Document.ContentStart, rtxtMessageEdit.Document.ContentEnd);
                    textRange.Text = "";
                    rtxtMessageEdit.ScrollToHome();
                    rtxtMessageEdit.CaretPosition = rtxtMessageEdit.Document.ContentStart;

                    e.Handled = true;
                }
                else if (Keyboard.Modifiers == ModifierKeys.Shift && e.Key == Key.Insert)
                {
                    e.Handled = true;
                    return;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #26
0
        // 2013-12-12: GreenRose
        // 패스워드 유효성검사하는 함수
        private bool CheckPassword(string strPassword, string strUserID)
        {
            try
            {
                if (strPassword.Length < 6)
                {
                    //MessageBoxCommon.Show("비밀번호는 문자, 수자 조합으로 6~16자리로 입력해주세요.", MessageBoxType.Ok);
                    TempWindowForm tempWindowForm = new TempWindowForm();
                    QQMessageBox.Show(tempWindowForm, "密码由字母和数字组合6-16位 请重新输入", "提示", QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                    return(false);
                }

                System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"[a-zA-Z]");
                System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@"[0-9]");
                if (!regex1.IsMatch(strPassword) || !regex2.IsMatch(strPassword))
                {
                    //MessageBoxCommon.Show("비밀번호는 문자, 수자 조합으로 6~16자리로 입력해주세요.", MessageBoxType.Ok);
                    TempWindowForm tempWindowForm = new TempWindowForm();
                    QQMessageBox.Show(tempWindowForm, "密码由字母和数字组合6-16位 请重新输入", "提示", QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                    return(false);
                }

                if (strPassword.IndexOf(strUserID) > -1)
                {
                    //MessageBoxCommon.Show("비밀번호에 아이디를 사용할수 없습니다.", MessageBoxType.Ok);
                    TempWindowForm tempWindowForm = new TempWindowForm();
                    QQMessageBox.Show(tempWindowForm, "密码不能和ID重复密码过于简单", "提示", QQMessageBoxIcon.Error, QQMessageBoxButtons.OK);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);

                return(false);
            }

            return(true);
        }
Beispiel #27
0
 private void txtUserName_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.Enter)
         {
             if (txtUserName.Text != string.Empty)
             {
                 txtPassword.Focus();
             }
             else
             {
                 txtUserName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         string strError = ex.ToString();
         ErrorCollection.GetInstance().SetErrorInfo(strError);
     }
 }
        public void TitleDownloadComplete(string filePath)
        {
            try
            {
                //복호화한다. 2014-2-25 by pakcj
                //string decPath = WebDownloader.GetInstance().DecryptFile(filePath);
                string decPath = filePath;

                string      strImagePath = decPath;
                BitmapImage bi           = new BitmapImage();

                bi.BeginInit();
                bi.UriSource   = new Uri(strImagePath, UriKind.RelativeOrAbsolute);
                bi.CacheOption = BitmapCacheOption.OnLoad;
                bi.EndInit();

                image1.Source = bi;
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                stackPanel1.Children.Clear();

                userGrid = new Microsoft.Windows.Controls.DataGrid();

                userGrid.Height = 220;
                //userGrid.MouseDown += new MouseButtonEventHandler(userGrid_MouseClick);
                userGrid.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(userGrid_MouseClick);
                userGrid.SelectionUnit = Microsoft.Windows.Controls.DataGridSelectionUnit.Cell;
                userGrid.SelectionMode = Microsoft.Windows.Controls.DataGridSelectionMode.Extended;

                userGrid.HeadersVisibility   = Microsoft.Windows.Controls.DataGridHeadersVisibility.Column;
                userGrid.GridLinesVisibility = Microsoft.Windows.Controls.DataGridGridLinesVisibility.Horizontal;

                userGrid.IsReadOnly        = true;
                userGrid.Style             = (Style)FindResource("DataGridStyle");
                userGrid.CellStyle         = (Style)FindResource("cellStyle");
                userGrid.RowStyle          = (Style)FindResource("rowStyle");
                userGrid.ColumnHeaderStyle = (Style)FindResource("columnHeaderStyle");
                userGrid.Background        = new SolidColorBrush(Colors.Transparent);

                userGrid.SelectionMode = Microsoft.Windows.Controls.DataGridSelectionMode.Single;
                userGrid.SelectionUnit = Microsoft.Windows.Controls.DataGridSelectionUnit.FullRow;

                Microsoft.Windows.Controls.DataGridCheckBoxColumn col1 = new Microsoft.Windows.Controls.DataGridCheckBoxColumn();
                col1.Width = 48;
                Microsoft.Windows.Controls.DataGridTextColumn col2 = new Microsoft.Windows.Controls.DataGridTextColumn();
                col2.Width = 130;
                Microsoft.Windows.Controls.DataGridTextColumn col3 = new Microsoft.Windows.Controls.DataGridTextColumn();
                //col3.Width = new Microsoft.Windows.Controls.DataGridLength(115, Microsoft.Windows.Controls.DataGridLengthUnitType.Star);
                col3.Width = 115;

                userGrid.Columns.Add(col1);
                userGrid.Columns.Add(col2);
                userGrid.Columns.Add(col3);

                col1.Binding = new Binding("check");
                col2.Binding = new Binding("id");
                col3.Binding = new Binding("nickname");



                for (int j = 0; j < Login.userList.Count; j++)
                {
                    CheckBox chk = new CheckBox();
                    chk.IsChecked = false;
                    userGrid.Items.Add(new ChargeData
                    {
                        check    = chk,
                        id       = Login.userList[j].Id,
                        nickname = Login.userList[j].Nickname
                    });
                }

                col1.Header = "";
                col2.Header = "id";
                col3.Header = "niakName";

                stackPanel1.Children.Add(userGrid);
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Beispiel #30
0
        public void OnAgree()
        {
            //this.toolStripLabel_msg.Text = "正在连接 . . .";

            if (ChatClient.Login._UserInfo.Kind == (int)ChatEngine.UserKind.ServiceWoman)       // 여자인경우 자기카메라만 현시한다.
            {
                //this.qqGlassButton2.Image = MakeGrayscale3((Bitmap)(resources.GetObject("qqGlassButton2.Image")));
                //bAudioSending = false;
                int nResult = StartVideoCapture(ChatClient.Main._nCameraIndex);
                if (nResult == 0)
                {
                    IntPtr result   = GetLastErrorString();
                    string strError = Marshal.PtrToStringAnsi(result);

                    ErrorCollection.GetInstance().SetErrorInfo(strError);
                }

                nResult = StartAudioCapture();
                if (nResult == 0)
                {
                    IntPtr result   = GetLastErrorString();
                    string strError = Marshal.PtrToStringAnsi(result);

                    ErrorCollection.GetInstance().SetErrorInfo(strError);
                }

                SetCaptureWindow(this.panel1.Handle);

                nResult = StartSend();
                if (nResult == 0)
                {
                    IntPtr result   = GetLastErrorString();
                    string strError = Marshal.PtrToStringAnsi(result);

                    ErrorCollection.GetInstance().SetErrorInfo(strError);
                }

                //this.toolStripLabel_msg.Visible = false;
                //this.toolStripLabel_netstate.Visible = true;
                //this.toolStripButton_hideMyself.Visible = false;
                //this.toolStripButton_camera.Visible = true;
                //this.toolStripButton_microphone.Visible = false;
                //this.toolStripButton_speaker.Visible = false;
                //this.toolStripSeparator1.Visible = false;

                ChatClient.Login._UserInfo.nUserState = 21;
                ChatClient.Login._ClientEngine.Send(ChatEngine.NotifyType.Request_UserState, ChatClient.Login._UserInfo);
            }
            else
            {
                this.qqGlassButton1.Enabled = false;
                this.qqGlassButton2.Enabled = false;
                StringBuilder strFriendID = new StringBuilder(this.friendID);
                int           nResult     = StartReceive(strFriendID, this.panel1.Handle);
                if (nResult == 0)
                {
                    IntPtr result   = GetLastErrorString();
                    string strError = Marshal.PtrToStringAnsi(result);

                    ErrorCollection.GetInstance().SetErrorInfo(strError);
                }

                //this.toolStripLabel_msg.Visible = false;
                //this.toolStripLabel_netstate.Visible = true;
                //this.toolStripButton_hideMyself.Visible = false;
                //this.toolStripButton_camera.Visible = false;
                //this.toolStripButton_microphone.Visible = false;
                //this.toolStripButton_speaker.Visible = false;
                //this.toolStripSeparator1.Visible = false;

                //timer1.Start();
            }
        }