public void UpdateVotingInfo_Should_Return_Cached_Data_With_Updated_Votes()
        {
            var             _cacheInstance = MemoryCaching.Instance;
            BasicHttpClient _httpClient    = new BasicHttpClient(CreateFakeResponseHandler());

            _cacheInstance._cacheObject.Set("g2Roster", Cache_MockData(), new CacheItemPolicy());
            var _g2CrowdDataService = new G2CrowdDataService(_cacheInstance, _httpClient);
            var personalData        = new G2CrowdPersonalData {
                Name            = "Michael Wheeler",
                Title           = "CTO / Co-founder",
                Image_Url       = "https://d2eyrv63e6x6lp.cloudfront.net/wp-content/uploads/2015/02/20141833/Mike-Wheeler.jpg",
                Bio             = "Mike has been programming since his dad bought him an Apple II when he was 12, and he is as passionate about the craft of programming as he is about building and supporting a quality business. He came to G2Crowd from TapJoy, where he helped to launch a mobile webproduct to an audience of more than 3 million users. Mike also spent four years on the BigMachines team, harnessing the latest web standards to design, build, and launch innovative web applications. When he isn’t applying technological know-how to business problems, Mike can usually be found dancing lindy hop at one of Chicago’s many jazz clubs, or training at a Capoeira academy.",
                Number_Of_Votes = 5
            };

            _g2CrowdDataService.UpdateVotingInfo(personalData, Update_Info_Data());
            var result = (G2RosterModel)_cacheInstance._cacheObject.Get("g2Roster");

            Assert.AreEqual(result.G2CrowdRoster[0].Number_Of_Votes, 6);
        }
Example #2
0
 public CtlUploadModule()
 {
     try
     {
         InitializeComponent();
         ass                           = Assembly.GetAssembly(typeof(CtlUploadModule));
         btnUpload.Click              += new RoutedEventHandler(btnUpload_Click);
         btnBrowseMouleImage.Click    += new RoutedEventHandler(btnBrowseMouleImage_Click);
         btnSubmit.Click              += new RoutedEventHandler(btnSubmit_Click);
         btnCancel.Click              += new RoutedEventHandler(btnCancel_Click);
         cmbAssembly.SelectionChanged += new SelectionChangedEventHandler(cmbAssembly_SelectionChanged);
         this.IsVisibleChanged        += new DependencyPropertyChangedEventHandler(CtlUploadModule_IsVisibleChanged);
         BasicHttpClient bhcFiletransfer = new BasicHttpClient();
         clientHttpChannelFileTransfer = (IHTTPFileTransferService)bhcFiletransfer.OpenClient <IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
         clientHttpChannelFileTransfer.svcHTTPFileTransferServiceJoin();
     }
     catch (Exception ex)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "CtlUploadModule()", "Controls\\CtlUploadModule.xaml.cs");
     }
 }
        public ActionResult GetJobByRole(string Role)
        {
            JobViewModel JobViewModel = new JobViewModel();

            JobViewModel.JobDetailList = new List <JobDetailViewModel>();
            BasicHttpClient basicHttpClient = new BasicHttpClient();
            var             JobModel        = basicHttpClient.OpeningJobsByRole(Role);

            if (JobModel != null)
            {
                foreach (var item in JobModel.JobDetailList)
                {
                    JobDetailViewModel JobDetailViewModel = new JobDetailViewModel()
                    {
                        JobID          = item.JobID,
                        JobRole        = item.JobRole,
                        JobDescription = item.JobDescription
                    };

                    JobViewModel.JobDetailList.Add(JobDetailViewModel);
                }
            }
            return(PartialView("JobListByRole", JobViewModel));
        }
        public ActionResult GetJobDetailList()
        {
            JobViewModel JobViewModel = new JobViewModel();

            JobViewModel.JobDetailList = new List <JobDetailViewModel>();
            BasicHttpClient basicHttpClient = new BasicHttpClient();
            var             JobModel        = basicHttpClient.OpeningJobs();

            if (JobModel != null)
            {
                foreach (var item in JobModel.JobDetailList)
                {
                    JobDetailViewModel JobDetailViewModel = new JobDetailViewModel()
                    {
                        JobID          = item.JobID,
                        JobRole        = item.JobRole,
                        JobDescription = item.JobDescription
                    };

                    JobViewModel.JobDetailList.Add(JobDetailViewModel);
                }
            }
            return(Json(JobViewModel, JsonRequestBehavior.AllowGet));
        }
        /////

        //System.Windows.Forms.PropertyGrid propGrid = new System.Windows.Forms.PropertyGrid();

        // Raxit code //

        public ctlScriptDesigner(string sName)
        {
            InitializeComponent();

            ScriptName = sName;
            this.Loaded += new RoutedEventHandler(ctlScriptDesigner_Loaded);

            FncFillCombo();
            cmbScript.SelectionChanged += new SelectionChangedEventHandler(cmbScript_SelectionChanged);
            flag = false;
            btnDrag.PreviewMouseDown += new MouseButtonEventHandler(btnDrag_PreviewMouseDown);
            txtDrag999.PreviewMouseDown += new MouseButtonEventHandler(txtDrag_PreviewMouseDown);
            lblDrag999.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);
            cmbDrag999.PreviewMouseDown += new MouseButtonEventHandler(cmbDrag999_PreviewMouseDown);
            lstDrag999.PreviewMouseDown += new MouseButtonEventHandler(lstDrag999_PreviewMouseDown);
            chkDrag999.PreviewMouseDown += new MouseButtonEventHandler(chkDrag999_PreviewMouseDown);
            radDrag999.PreviewMouseDown += new MouseButtonEventHandler(radDrag999_PreviewMouseDown);
            txbDrag999.PreviewMouseDown += new MouseButtonEventHandler(txbDrag999_PreviewMouseDown);

            cnvPaint.Drop += new DragEventHandler(cnvPaint_Drop);
            cnvPaint.DragOver += new DragEventHandler(cnvPaint_DragOver);
            cnvPaint.PreviewMouseUp += new MouseButtonEventHandler(ctlScriptDesigner_PreviewMouseUp);
            cnvPaint.PreviewMouseDown += new MouseButtonEventHandler(ctlScriptDesigner_PreviewMouseDown);
            cnvPaint.PreviewMouseMove += new MouseEventHandler(ctlScriptDesigner_MouseMove);
            cnvPaint.MouseMove += new MouseEventHandler(cnvPaint_MouseMove);
            currentControl.SizeChanged += new SizeChangedEventHandler(currentControl_SizeChanged);

            cmbLeadFormat.SelectionChanged += new SelectionChangedEventHandler(cmbLeadFormat_SelectionChanged);

            btnBack.Click += new RoutedEventHandler(btnBack_Click);

            r1.Stroke = Brushes.White;

            r1.StrokeThickness = 3.0;
            r1.Fill = Brushes.Transparent;
            r1.StrokeDashArray = new DoubleCollection(2);
            MyPropGrid.Height = 550;
            MyPropGrid.Width = 200;
            MyPropGrid.SetValue(Canvas.LeftProperty, 600.0);
            myExpander1.Content = MyPropGrid;
            myExpander1.Expanded += new RoutedEventHandler(myExpander1_Expanded);
            myExpander1.Collapsed += new RoutedEventHandler(myExpander1_Collapsed);
            //cnvPaint.Children.Add(MyPropGrid);
            cnvPaint.Children.Add(r1);

            r1.SizeChanged += new SizeChangedEventHandler(r1_SizeChanged);

            this.PreviewKeyDown += new KeyEventHandler(ctlScriptDesigner_PreviewKeyDown);
            lblScript.Visibility = Visibility.Collapsed;
            cmbScript.Visibility = Visibility.Collapsed;
            btnGetQuestions.Visibility = Visibility.Collapsed;

            // Adding Combobox and a Button to Next Page Bind

            cmbQuest.Height = 25;
            cmbQuest.Width = 150;

            cmbQuest.SetValue(Canvas.LeftProperty, 390.0);
            cmbQuest.SetValue(Canvas.TopProperty, 2.0);

            cnvHead.Children.Add(cmbQuest);



            btnBindQuestion.Height = 25;
            btnBindQuestion.Width = 50;
            btnBindQuestion.Content = "Bind";
            btnBindQuestion.SetValue(Canvas.LeftProperty, 550.0);
            btnBindQuestion.SetValue(Canvas.TopProperty, 2.0);

            btnBindQuestion.Click += new RoutedEventHandler(btnBindQuestion_Click);

            cnvHead.Children.Add(btnBindQuestion);


            /////////////////////////////////////////////////

            btnAPI.Click += new RoutedEventHandler(btnAPI_Click);
            btnDispo.Click += new RoutedEventHandler(btnDispo_Click);
            

            GetQuestions();
            FncFillCampaign();

            BasicHttpClient bhcFts = new BasicHttpClient();
            clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
            clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();


            if (clsStartClass.ScriptName != null && clsStartClass.ScriptType != null)
            {
                string script = clsStartClass.ScriptName;
                string scriptType = clsStartClass.ScriptType;

                if (scriptType.Equals("Static"))
                {
                    lblDrag999.SetValue(Canvas.LeftProperty, txtDrag999.GetValue(Canvas.LeftProperty));
                    lblDrag999.SetValue(Canvas.TopProperty, txtDrag999.GetValue(Canvas.TopProperty));

                    cnvControls.Children.Remove(txtDrag999);
                    cnvControls.Children.Remove(cmbDrag999);
                    cnvControls.Children.Remove(lstDrag999);
                    cnvControls.Children.Remove(radDrag999);
                    cnvControls.Children.Remove(chkDrag999);
                    grdControls.Height = grdControls.Height - 160;
                    //cmbDrag999.Visibility = Visibility.Collapsed;
                    //lstDrag999.Visibility = Visibility.Collapsed;
                    //radDrag999.Visibility = Visibility.Collapsed;
                    //chkDrag999.Visibility = Visibility.Collapsed;
                }
                else
                {
                    txtDrag999.Visibility = Visibility.Visible;
                    cmbDrag999.Visibility = Visibility.Visible;
                    lstDrag999.Visibility = Visibility.Visible;
                    radDrag999.Visibility = Visibility.Visible;
                    chkDrag999.Visibility = Visibility.Visible;

                }
            }
        }
        //public ctlCRMDesigner(ModulePermissions[] MyPermissions)
        //{
        //    try
        //    {
        //        //InitializeComponent();
        //        this.Loaded += new RoutedEventHandler(ctlCRMDesigner_Loaded);

        //        _MyPermissions = MyPermissions;
        //        FncPermissionsReview();
        //        currentControl = new ctlPOD();
        //        MyPropGrid = new ctlPropertyGrid();

        //        FncFillCombo();
        //        //cmbScript.SelectionChanged += new SelectionChangedEventHandler(cmbScript_SelectionChanged);


        //        txtDrag999.PreviewMouseDown += new MouseButtonEventHandler(txtDrag_PreviewMouseDown);
        //        lblDrag999.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);

        //        btnNewTab.Click += new RoutedEventHandler(btnNewTab_Click);
        //        cnvPaint.Drop += new DragEventHandler(cnvPaint_Drop);
        //        //tbi.Drop += new DragEventHandler(tbi_Drop);
        //        cnvPaint.DragOver += new DragEventHandler(cnvPaint_DragOver);
        //        cnvPaint.PreviewMouseUp += new MouseButtonEventHandler(ctlCRMDesigner_PreviewMouseUp);
        //        cnvPaint.PreviewMouseDown += new MouseButtonEventHandler(ctlCRMDesigner_PreviewMouseDown);
        //        cnvPaint.PreviewMouseMove += new MouseEventHandler(ctlCRMDesigner_MouseMove);
        //        cnvPaint.MouseMove += new MouseEventHandler(cnvPaint_MouseMove);
        //        currentControl.SizeChanged += new SizeChangedEventHandler(currentControl_SizeChanged);

        //        cmbLeadFormat.SelectionChanged += new SelectionChangedEventHandler(cmbLeadFormat_SelectionChanged);

        //        r1.Stroke = Brushes.White;

        //        r1.StrokeThickness = 3.0;
        //        r1.Fill = Brushes.Transparent;
        //        r1.StrokeDashArray = new DoubleCollection(2);
        //        MyPropGrid.Height = 500;
        //        MyPropGrid.Width = 200;
        //        MyPropGrid.SetValue(Canvas.LeftProperty, 650.0);
        //        MyPropGrid.SetValue(Canvas.TopProperty, 0.0);
        //        myExpander1.Content = MyPropGrid;
        //        myExpander1.Expanded += new RoutedEventHandler(myExpander1_Expanded);
        //        myExpander1.Collapsed += new RoutedEventHandler(myExpander1_Collapsed);
        //        //cnvPaint.Children.Add(MyPropGrid);
        //        cnvPaint.Children.Add(r1);

        //        r1.SizeChanged += new SizeChangedEventHandler(r1_SizeChanged);

        //        this.PreviewKeyDown += new KeyEventHandler(ctlCRMDesigner_PreviewKeyDown);

        //        FncCreateTabItems();

        //        txtHeight.KeyDown += new KeyEventHandler(txtHeight_KeyDown);
        //        txtWidth.KeyDown += new KeyEventHandler(txtWidth_KeyDown);

        //        txtHeight.LostFocus += new RoutedEventHandler(txtHeight_LostFocus);
        //        txtWidth.LostFocus += new RoutedEventHandler(txtWidth_LostFocus);
        //        txtHeader.GotFocus += new RoutedEventHandler(txtHeader_GotFocus);

        //        txtHeight.Text = int.Parse(tbcMain.Height.ToString()).ToString();
        //        txtWidth.Text = int.Parse(tbcMain.Width.ToString()).ToString();

        //        ClsCRMCollection objClsCRMCollection = ClsCRMCollection.GetAll();
        //        for (int i = 0; i < objClsCRMCollection.Count; i++)
        //        {
        //            ComboBoxItem cmb1 = new ComboBoxItem();
        //            cmb1.Content = objClsCRMCollection[i].CRMName;
        //            cmb1.Tag = objClsCRMCollection[i].ID;
        //            cmbCRM.Items.Add(cmb1);
        //        }
        //        try
        //        {

        //            BasicHttpClient bhcFts = new BasicHttpClient();
        //            clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient<IHTTPFileTransferService>("http://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
        //            clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();
        //        }
        //        catch (Exception ex)
        //        {
        //            ex.Data.Add("My Key", "VMukti--:--VmuktiModules--:--Call Center--:--CRMDesigner--:--CRMDesigner.Presentation--:--ctlCRMDesigner.xaml.cs--:--ctlCRMDesigner()--");
        //            //ClsException.LogError(ex);
        //            //ClsException.WriteToErrorLogFile(ex);
        //            System.Text.StringBuilder sb = new StringBuilder();
        //            sb.AppendLine(ex.Message);
        //            sb.AppendLine();
        //            sb.AppendLine("StackTrace : " + ex.StackTrace);
        //            sb.AppendLine();
        //            sb.AppendLine("Location : " + ex.Data["My Key"].ToString());
        //            sb.AppendLine();
        //            sb1 = CreateTressInfo();
        //            sb.Append(sb1.ToString());
        //            VMuktiAPI.ClsLogging.WriteToTresslog(sb);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }

        //}

        public ctlCRMDesigner(string TempCRM)
        {
            InitializeComponent();
            CRMName = TempCRM;
            currentControl = new ctlPOD();
            MyPropGrid = new ctlPropertyGrid();
            this.Loaded+=new RoutedEventHandler(ctlCRMDesigner_Loaded);
            FncFillCombo();
            flag = false;
            
            txtDrag999.PreviewMouseDown += new MouseButtonEventHandler(txtDrag_PreviewMouseDown);
            lblDrag999.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);

            btnNewTab.Click += new RoutedEventHandler(btnNewTab_Click);
            cnvPaint.Drop += new DragEventHandler(cnvPaint_Drop);
            //tbi.Drop += new DragEventHandler(tbi_Drop);
            cnvPaint.DragOver += new DragEventHandler(cnvPaint_DragOver);
            cnvPaint.PreviewMouseUp += new MouseButtonEventHandler(ctlCRMDesigner_PreviewMouseUp);
            cnvPaint.PreviewMouseDown += new MouseButtonEventHandler(ctlCRMDesigner_PreviewMouseDown);
            cnvPaint.PreviewMouseMove += new MouseEventHandler(ctlCRMDesigner_MouseMove);
            cnvPaint.MouseMove += new MouseEventHandler(cnvPaint_MouseMove);
            currentControl.SizeChanged += new SizeChangedEventHandler(currentControl_SizeChanged);


            r1.Stroke = Brushes.White;

            r1.StrokeThickness = 3.0;
            r1.Fill = Brushes.Transparent;
            r1.StrokeDashArray = new DoubleCollection(2);
            MyPropGrid.Height = 500;
            MyPropGrid.Width = 200;
            MyPropGrid.SetValue(Canvas.LeftProperty, 650.0);
            MyPropGrid.SetValue(Canvas.TopProperty, 0.0);
            myExpander1.Content = MyPropGrid;
            myExpander1.Expanded += new RoutedEventHandler(myExpander1_Expanded);
            myExpander1.Collapsed += new RoutedEventHandler(myExpander1_Collapsed);
            //cnvPaint.Children.Add(MyPropGrid);
            cnvPaint.Children.Add(r1);

            r1.SizeChanged += new SizeChangedEventHandler(r1_SizeChanged);

            this.PreviewKeyDown += new KeyEventHandler(ctlCRMDesigner_PreviewKeyDown);

            FncCreateTabItems();

            txtHeight.KeyDown += new KeyEventHandler(txtHeight_KeyDown);
            txtWidth.KeyDown += new KeyEventHandler(txtWidth_KeyDown);

            txtHeight.LostFocus += new RoutedEventHandler(txtHeight_LostFocus);
            txtWidth.LostFocus += new RoutedEventHandler(txtWidth_LostFocus);
            txtHeader.GotFocus += new RoutedEventHandler(txtHeader_GotFocus);

            txtHeight.Text = int.Parse(tbcMain.Height.ToString()).ToString();
            txtWidth.Text = int.Parse(tbcMain.Width.ToString()).ToString();


            //lblCRM.Visibility = Visibility.Collapsed;
            //cmbCRM.Visibility = Visibility.Collapsed;
            //btnGetQuestions.Visibility = Visibility.Collapsed;
            
            ClsCRMCollection objClsCRMCollection = ClsCRMCollection.GetAll();
            for (int i = 0; i < objClsCRMCollection.Count; i++)
            {
                ComboBoxItem cmb1 = new ComboBoxItem();
                cmb1.Content = objClsCRMCollection[i].CRMName;
                cmb1.Tag = objClsCRMCollection[i].ID;
                cmbCRM.Items.Add(cmb1);
                if (objClsCRMCollection[i].ID.ToString() == CRMName)
                {
                    cmbCRM.Text = cmb1.Content.ToString();
                }
            }
            //cmbCRM.Text = CRMName;
            cmbCRM.IsEnabled = false;
            cmbCRM.SelectionChanged+=new SelectionChangedEventHandler(cmbCRM_SelectionChanged);
            
            cmbLeadFormat.SelectionChanged += new SelectionChangedEventHandler(cmbLeadFormat_SelectionChanged);

            try
            {
                BasicHttpClient bhcFts = new BasicHttpClient();
                clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
                clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "ctlCRMDesigner()", "ctlCRMDesigner.xaml.cs");
            }
            GetQuestions();
            

            //return 0;
        }
Example #7
0
        bool FncPort80Free()
        {
            try
            {
                object objHttpBootStrap = null;
                objHttpBootStrap = new BootStrapDelegates();
                BasicHttpServer bhsHttpBootStrap = new BasicHttpServer(ref objHttpBootStrap, "http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP + ":80/HttpBootStrap");
                bhsHttpBootStrap.AddEndPoint<IHTTPBootStrapService>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP + ":80/HttpBootStrap");
                bhsHttpBootStrap.OpenServer();
                bhsHttpBootStrap.CloseServer();
                return true;
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "FncPort80busy()", "App.xaml.cs");
                return false;
            }

        }
Example #8
0
        void GlobalVariable()
        {
            try
            {
                objHttpBootStrap = new BasicHttpClient();
                objHttpSuperNode = new BasicHttpClient();

                pageCounter = 0;
                tabCounter = 0;
                podCounter = 0;
                blnIsTwoPanel = true;

                disposed = false;
                blnNodeOff = false;

                NetAvail = false;
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "GlobalVariable", "App.xaml.cs");
            }
        }
        public ctlCRMDesigner(ModulePermissions[] MyPermissions)
        {
            try
            {
                InitializeComponent();
                this.Loaded += new RoutedEventHandler(ctlCRMDesigner_Loaded);

                _MyPermissions = MyPermissions;
                FncPermissionsReview();
                currentControl = new ctlPOD();
                MyPropGrid = new ctlPropertyGrid();

                FncFillCombo();
                //cmbScript.SelectionChanged += new SelectionChangedEventHandler(cmbScript_SelectionChanged);


                txtDrag999.PreviewMouseDown += new MouseButtonEventHandler(txtDrag_PreviewMouseDown);
                lblDrag999.PreviewMouseDown += new MouseButtonEventHandler(lblDrag_PreviewMouseDown);

                btnNewTab.Click += new RoutedEventHandler(btnNewTab_Click);
                cnvPaint.Drop += new DragEventHandler(cnvPaint_Drop);
                //tbi.Drop += new DragEventHandler(tbi_Drop);
                cnvPaint.DragOver += new DragEventHandler(cnvPaint_DragOver);
                cnvPaint.PreviewMouseUp += new MouseButtonEventHandler(ctlCRMDesigner_PreviewMouseUp);
                cnvPaint.PreviewMouseDown += new MouseButtonEventHandler(ctlCRMDesigner_PreviewMouseDown);
                cnvPaint.PreviewMouseMove += new MouseEventHandler(ctlCRMDesigner_MouseMove);
                cnvPaint.MouseMove += new MouseEventHandler(cnvPaint_MouseMove);
                currentControl.SizeChanged += new SizeChangedEventHandler(currentControl_SizeChanged);

                cmbLeadFormat.SelectionChanged += new SelectionChangedEventHandler(cmbLeadFormat_SelectionChanged);

                r1.Stroke = Brushes.White;

                r1.StrokeThickness = 3.0;
                r1.Fill = Brushes.Transparent;
                r1.StrokeDashArray = new DoubleCollection(2);
                MyPropGrid.Height = 500;
                MyPropGrid.Width = 200;
                MyPropGrid.SetValue(Canvas.LeftProperty, 650.0);
                MyPropGrid.SetValue(Canvas.TopProperty, 0.0);
                myExpander1.Content = MyPropGrid;
                myExpander1.Expanded += new RoutedEventHandler(myExpander1_Expanded);
                myExpander1.Collapsed += new RoutedEventHandler(myExpander1_Collapsed);
                //cnvPaint.Children.Add(MyPropGrid);
                cnvPaint.Children.Add(r1);

                r1.SizeChanged += new SizeChangedEventHandler(r1_SizeChanged);

                this.PreviewKeyDown += new KeyEventHandler(ctlCRMDesigner_PreviewKeyDown);

                FncCreateTabItems();

                txtHeight.KeyDown += new KeyEventHandler(txtHeight_KeyDown);
                txtWidth.KeyDown += new KeyEventHandler(txtWidth_KeyDown);

                txtHeight.LostFocus += new RoutedEventHandler(txtHeight_LostFocus);
                txtWidth.LostFocus += new RoutedEventHandler(txtWidth_LostFocus);
                txtHeader.GotFocus += new RoutedEventHandler(txtHeader_GotFocus);

                txtHeight.Text = int.Parse(tbcMain.Height.ToString()).ToString();
                txtWidth.Text = int.Parse(tbcMain.Width.ToString()).ToString();

                ClsCRMCollection objClsCRMCollection = ClsCRMCollection.GetAll();
                for (int i = 0; i < objClsCRMCollection.Count; i++)
                {
                    ComboBoxItem cmb1 = new ComboBoxItem();
                    cmb1.Content = objClsCRMCollection[i].CRMName;
                    cmb1.Tag = objClsCRMCollection[i].ID;
                    cmbCRM.Items.Add(cmb1);
                }
                try
                {

                    BasicHttpClient bhcFts = new BasicHttpClient();
                    clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient<IHTTPFileTransferService>("http://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
                    clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();
                }
                catch (Exception ex)
                {
                    ex.Data.Add("My Key", "VMukti--:--VmuktiModules--:--Call Center--:--CRMDesigner--:--CRMDesigner.Presentation--:--ctlCRMDesigner.xaml.cs--:--ctlCRMDesigner()--");
                    //ClsException.LogError(ex);
                    //ClsException.WriteToErrorLogFile(ex);
                    System.Text.StringBuilder sb = new StringBuilder();
                    sb.AppendLine(ex.Message);
                    sb.AppendLine();
                    sb.AppendLine("StackTrace : " + ex.StackTrace);
                    sb.AppendLine();
                    sb.AppendLine("Location : " + ex.Data["My Key"].ToString());
                    sb.AppendLine();
                    sb1 = CreateTressInfo();
                    sb.Append(sb1.ToString());
                    VMuktiAPI.ClsLogging.WriteToTresslog(sb);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
Example #10
0
        void bgHostService_DoWork(object sender, DoWorkEventArgs e)
        {
            List <object> lstTempObj = (List <object>)e.Argument;

            strUri = lstTempObj[1].ToString();

            try
            {
                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcImageShare = new NetPeerClient();

                    ((clsNetTcpImageSharing)objNetTcpImageShare).EntsvcJoin      += new clsNetTcpImageSharing.delsvcJoin(ctlImageSharing_EntsvcJoin);
                    ((clsNetTcpImageSharing)objNetTcpImageShare).EntsvcSendIamge += new clsNetTcpImageSharing.delsvcSendIamge(ctlImageSharing_EntsvcSendIamge);
                    ((clsNetTcpImageSharing)objNetTcpImageShare).EntsvcUnJoin    += new clsNetTcpImageSharing.delsvcUnJoin(ctlImageSharing_EntsvcUnJoin);


                    channelNetTcp = (INetTcpImageShareChannel)npcImageShare.OpenClient <INetTcpImageShareChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpImageShare);

                    while (temp < 20)
                    {
                        try
                        {
                            channelNetTcp.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);

                            temp = 20;
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }

                else
                {
                    BasicHttpClient bhcImageSharing = new BasicHttpClient();
                    bhcImageSharing.NewBasicHttpBinding().TransferMode = TransferMode.Streamed;

                    channelHttp = (IHttpImageSharing)bhcImageSharing.OpenClient <IHttpImageSharing>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            MemoryStream mmsFinal = new MemoryStream();
                            char         del      = '#';
                            Stream       mmsUName = fncStringToStream(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            mmsUName.Position = 0;
                            byte[] byteName = fncStreamToByteArry(mmsUName);

                            mmsFinal.Write(byteName, 0, byteName.Length);
                            mmsFinal.WriteByte((byte)del);
                            mmsFinal.WriteByte((byte)del);
                            mmsFinal.WriteByte((byte)del);
                            mmsFinal.Position = 0;

                            channelHttp.svcJoin(mmsFinal);
                            tempcounter = 20;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    dispHttpTimer.Interval = TimeSpan.FromSeconds(2);
                    dispHttpTimer.Tick    += new EventHandler(dispHttpTimer_Tick);
                    dispHttpTimer.Start();
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "HostImageService", "ctlImageSharing.xaml.cs");
            }
        }
        void bgHostService_DoWork(object sender, DoWorkEventArgs e)
        {

            List<object> lstTempObj = (List<object>)e.Argument;
            strUri = lstTempObj[1].ToString();

            try
            {
                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcImageShare = new NetPeerClient();

                    ((clsNetTcpImageSharing)objNetTcpImageShare).EntsvcJoin += new clsNetTcpImageSharing.delsvcJoin(ctlImageSharing_EntsvcJoin);
                    ((clsNetTcpImageSharing)objNetTcpImageShare).EntsvcSendIamge += new clsNetTcpImageSharing.delsvcSendIamge(ctlImageSharing_EntsvcSendIamge);
                    ((clsNetTcpImageSharing)objNetTcpImageShare).EntsvcUnJoin += new clsNetTcpImageSharing.delsvcUnJoin(ctlImageSharing_EntsvcUnJoin);


                    channelNetTcp = (INetTcpImageShareChannel)npcImageShare.OpenClient<INetTcpImageShareChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpImageShare);

                    while (temp < 20)
                    {
                        try
                        {
                            channelNetTcp.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);

                            temp = 20;
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }

                else
                {
                    BasicHttpClient bhcImageSharing = new BasicHttpClient();
                    bhcImageSharing.NewBasicHttpBinding().TransferMode = TransferMode.Streamed;
                    
                    channelHttp = (IHttpImageSharing)bhcImageSharing.OpenClient<IHttpImageSharing>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {

                            MemoryStream mmsFinal = new MemoryStream();
                            char del = '#';
                            Stream mmsUName = fncStringToStream(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            mmsUName.Position = 0;
                            byte[] byteName = fncStreamToByteArry(mmsUName);

                            mmsFinal.Write(byteName, 0, byteName.Length);
                            mmsFinal.WriteByte((byte)del);
                            mmsFinal.WriteByte((byte)del);
                            mmsFinal.WriteByte((byte)del);
                            mmsFinal.Position = 0;

                            channelHttp.svcJoin(mmsFinal);
                            tempcounter = 20;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                    
                    dispHttpTimer.Interval = TimeSpan.FromSeconds(2);
                    dispHttpTimer.Tick += new EventHandler(dispHttpTimer_Tick);
                    dispHttpTimer.Start();

                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "HostImageService", "ctlImageSharing.xaml.cs");
            }
        }
        void RegClient(object videoURI)
        {
            lock (this)
            {
                try
                {
                    if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.SuperNode || VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithNetP2P)
                    {
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcJoin += new ClsNetP2PUserVideo.delsvcJoin(ctlUserVideo_EntsvcJoin);
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(ctlUserVideo_EntsvcSendStream);
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcUnJoin += new ClsNetP2PUserVideo.delsvcUnJoin(ctlUserVideo_EntsvcUnJoin);

                        npcDirectXVideo = new NetPeerClient();
                        netp2pDirectXVideoChannel = (INetP2PUserVideoChannel)npcDirectXVideo.OpenClient<INetP2PUserVideoChannel>(videoURI.ToString(), videoURI.ToString().Split(':')[2].Split('/')[2], ref objDirectXVideo);
                        netp2pDirectXVideoChannel.svcJoin(MyUserName);
                    }
                    else
                    {
                        int count = 0;
                        while (count < 90)
                        {
                            try
                            {
                                bhcDirectXVideo = new BasicHttpClient();
                                httpDirectXVideoChannel = (IHttpUserVideo)bhcDirectXVideo.OpenClient<IHttpUserVideo>(videoURI.ToString());
                                httpDirectXVideoChannel.svcJoin(MyUserName);

                                count = 90;

                                if (MyVidType != "Me")
                                {
                                    disptGetImages.Start();
                                }
                            }
                            catch
                            {
                                System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
                                count++;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegClient", "ctlUserVideo.xaml.cs");             
                }
            }
        }
        private void FncHostFileSearchService(object lstParams)
        {
            try
            {
                List<object> lstTempObj = (List<object>)lstParams;
                strUri = lstTempObj[1].ToString();

                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcFileSearch = new NetPeerClient();
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcJoin+=new clsNetTcpFileSearch.delsvcJoin(FileSearch_EntsvcJoin);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcRequestFile+=new clsNetTcpFileSearch.delsvcRequestFile(FileSearch_EntsvcRequestFile);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcSearchQuery+=new clsNetTcpFileSearch.delsvcSearchQuery(FileSearch_EntsvcSearchQuery);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcSearchResult+=new clsNetTcpFileSearch.delsvcSearchResult(FileSearch_EntsvcSearchResult);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcSendFileBlock+=new clsNetTcpFileSearch.delsvcSendFileBlock(FileSearch_EntsvcSendFileBlock);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcGetUserList += new clsNetTcpFileSearch.delsvcGetUserList(FileSearch_EntsvcGetUserList);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcSetUserList += new clsNetTcpFileSearch.delsvcSetUserList(FileSearch_EntsvcSetUserList);
                    ((clsNetTcpFileSearch)objNetTcpFileSearch).EntsvcUnJoin+=new clsNetTcpFileSearch.delsvcUnJoin(FileSearch_EntsvcUnJoin);
                    NetP2PChannel = (IFileTransferChannel)npcFileSearch.OpenClient<IFileTransferChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpFileSearch);
                    //**Opening NetP2p Client for FileSearch.

                    while (Counter < 20)
                    {
                        try
                        {
                            NetP2PChannel.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            Counter = 20;
                            NetP2PChannel.svcGetUserList(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                        }
                        catch
                        {
                            Counter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }
                else
                {
                    BasicHttpClient BasicFileSearchClient = new BasicHttpClient();
                    HttpChannel = (IHttpFileSearchChannel)BasicFileSearchClient.OpenClient<IHttpFileSearchChannel>(strUri);
                    //**opening Http client for FileSearch module

                    while (tempcounter < 20)
                    {
                        try
                        {
                            HttpChannel.svcHttpJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            tempcounter = 20;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                    dt.Interval = TimeSpan.FromSeconds(5);
                    dt.Tick += new EventHandler(dt_Tick);
                    dt.Start();

                    dtGetFileList.Interval = TimeSpan.FromSeconds(10);
                    dtGetFileList.Tick += new EventHandler(dtGetFileList_Tick);
                    dtGetFileList.Start();
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncHostFileSearchService", "FileSearch.xaml.cs");
                if (ex.InnerException != null)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncHostFileSearchService", "FileSearch.xaml.cs");

                }
            }
        }
Example #14
0
        public void hostchatservice(object lstParams)
        {
            List<object> lstTempObj = (List<object>)lstParams;
            strUri = lstTempObj[1].ToString();
            try
            {
                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcChat = new NetPeerClient();
                    ((clsNetTcpChat)objNetTcpChat).EntsvcJoin += new clsNetTcpChat.delsvcJoin(wndChat_EntsvcJoin);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcSendMessage += new clsNetTcpChat.delsvcSendMessage(wndChat_EntsvcSendMessage);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcGetUserList += new clsNetTcpChat.delsvcGetUserList(ctlChat_EntsvcGetUserList);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcSetUserList += new clsNetTcpChat.delsvcSetUserList(ctlChat_EntsvcSetUserList);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcSignOutChat += new clsNetTcpChat.delsvcSignOutChat(ctlChat_EntsvcSignOutChat);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcUnJoin += new clsNetTcpChat.delsvcUnJoin(wndChat_EntsvcUnJoin);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcShowStatus += new clsNetTcpChat.delsvcShowStatus(ctlChat_EntsvcShowStatus);

                    channelNetTcp = (INetTcpChatChannel)npcChat.OpenClient<INetTcpChatChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpChat);
                   
                    while (temp < 20)
                    {
                        try
                        {
                            channelNetTcp.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                           
                            temp = 20;
                           
                            channelNetTcp.svcGetUserList(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }

                    }

                    //ClsException.WriteToLogFile("Chat Module:Opened Chat P2P Client");
                    //ClsException.WriteToLogFile("Uri for opening the client is : " + strUri);
                    //ClsException.WriteToLogFile("MeshId for opening the client is : " + strUri.ToString().Split(':')[2].Split('/')[1]); 
                }
                else
                {
                   
                    BasicHttpClient bhcChat = new BasicHttpClient();
                    channelHttp = (IHttpChat)bhcChat.OpenClient<IHttpChat>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            channelHttp.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            tempcounter = 20;
                            
                            channelHttp.svcGetUserList(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            
                            txtChat.IsEnabled = true;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    dispTimer.Interval = TimeSpan.FromSeconds(2);
                    dispTimer.Tick += new EventHandler(dispTimer_Tick);
                    dispTimer.Start();

                    //ClsException.WriteToLogFile("chat module: Opened Http Chat Client with Timers");
                    //ClsException.WriteToLogFile("Uri for opening the client is : " + strUri);
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "hostchatservice()", "ctlChat.xaml.cs");
            }
        }
Example #15
0
        void bgHostService_DoWork(object sender, DoWorkEventArgs e)
        {
            List<object> lstTempObj = (List<object>)e.Argument;
            strUri = lstTempObj[1].ToString();
            try
            {
                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcChat = new NetPeerClient();
                    ((clsNetTcpChat)objNetTcpChat).EntsvcJoin += new clsNetTcpChat.delsvcJoin(wndChat_EntsvcJoin);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcSendMessage += new clsNetTcpChat.delsvcSendMessage(wndChat_EntsvcSendMessage);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcGetUserList += new clsNetTcpChat.delsvcGetUserList(ctlChat_EntsvcGetUserList);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcSetUserList += new clsNetTcpChat.delsvcSetUserList(ctlChat_EntsvcSetUserList);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcSignOutChat += new clsNetTcpChat.delsvcSignOutChat(ctlChat_EntsvcSignOutChat);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcUnJoin += new clsNetTcpChat.delsvcUnJoin(wndChat_EntsvcUnJoin);
                    ((clsNetTcpChat)objNetTcpChat).EntsvcShowStatus += new clsNetTcpChat.delsvcShowStatus(ctlChat_EntsvcShowStatus);

                    channelNetTcp = (INetTcpChatChannel)npcChat.OpenClient<INetTcpChatChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpChat);

                    while (temp < 20)
                    {
                        try
                        {
                            channelNetTcp.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);

                            temp = 20;

                            channelNetTcp.svcGetUserList(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }

                    }
                }
                else
                {

                    BasicHttpClient bhcChat = new BasicHttpClient();
                    channelHttp = (IHttpChat)bhcChat.OpenClient<IHttpChat>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            channelHttp.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            tempcounter = 20;

                            channelHttp.svcGetUserList(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);

                            txtChat.IsEnabled = true;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }


                    dispTimer.Interval = TimeSpan.FromSeconds(2);
                    dispTimer.Tick += new EventHandler(dispTimer_Tick);
                    dispTimer.Start();
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "hostchatservice()", "ctlChat.xaml.cs");
            }
        }
Example #16
0
        void hostSNodeVideoService(object lstParams)
        {
            try
            {
                List<object> lstTempObj = (List<object>)lstParams;
                strUri = lstTempObj[1].ToString();
                string strNetP2PURI = "";

                BasicHttpClient httpClient = new BasicHttpClient();
                channelSNodeHttp = (IHttpSNodeVideo)httpClient.OpenClient<IHttpSNodeVideo>(strUri);

                channelSNodeHttp.svcJoin(VMuktiInfo.CurrentPeer.DisplayName);
                strNetP2PURI = channelSNodeHttp.svcStartVideoServer(VMuktiInfo.CurrentPeer.DisplayName, lstTempObj[0].ToString());

                List<object> lstData = new List<object>();
                lstData.Add(VMuktiInfo.CurrentPeer.DisplayName);
                lstData.Add(strNetP2PURI);
                lstData.Add("First");
                lstData.Add(lstTempObj[lstTempObj.Count - 1]);

                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, objGetUserList, lstData);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "hostSNodeVideoService", "ctlVideo.xaml.cs");             
            }
        }
        int DownloadAndExtractZipFile()
        {
            #region Download and Extract Zip file
            try
            {





                str = ScriptName;
                str += "_Script";

                Assembly ass = Assembly.GetEntryAssembly();
                // this maybe something like "using Vmuktiapi"
                filename = str + ".zip";

                #region Download Zip File using WCF FileTranserService

                try
                {
                    BasicHttpClient bhcFts = new BasicHttpClient();
                    clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
                    clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();
                    DownloadRequest request = new DownloadRequest();
                    RemoteFileInfo rfi = new RemoteFileInfo();

                    request.FileName = filename;
                    request.FolderWhereFileIsStored = "Scripts";
                    rfi = clientHttpFileTransfer.svcHTTPFileTransferServiceDownloadFile(request);

                

                    if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"Scripts")))
                    {
                        Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"Scripts"));
                    }
                    destination = ass.Location.Replace("VMukti.Presentation.exe", @"Scripts");

                 
                    filePath = destination + "\\" + filename;

                    System.IO.Stream inputStream = rfi.FileByteStream;


                    using (System.IO.FileStream writeStream = new System.IO.FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, FileShare.ReadWrite))
                    {
                        int chunkSize = 2048;
                        byte[] buffer = new byte[chunkSize];

                        do
                        {
                            // read bytes from input stream
                            int bytesRead = inputStream.Read(buffer, 0, chunkSize);
                            if (bytesRead == 0) break;

                            // write bytes to output stream
                            writeStream.Write(buffer, 0, bytesRead);

                        } while (true);
                        writeStream.Close();
                    }
                    //}
                }
                catch (Exception ex)
                {
                   
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "DownloadAndExtractZipFile", "ctlScriptdesigner.xaml.cs");
                    return -1;
                }

                #endregion

                #region Downloading ZipFile Using WebClient  -----Commented


                #endregion

                #region Extracting

                if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"ScriptModules")))
                {
                    Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"ScriptModules"));
                }



              
                try
                {
                    str = ScriptName;
                    str += "_Script";

                    Assembly ass2 = Assembly.GetEntryAssembly();

                    strModPath = ass2.Location.Replace("VMukti.Presentation.exe", @"ScriptModules");

                
                    
                  
                   
                }
                catch (Exception e)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(e, "DownloadAndExtractZipFile", "ctlScriptdesigner.xaml.cs");
                }





            
                ICSharpCode.SharpZipLib.Zip.FastZip fz = new ICSharpCode.SharpZipLib.Zip.FastZip();

               // if (!Directory.Exists(strModPath + "\\" + str  ))
                {
                    fz.ExtractZip(destination + "\\" + filename, strModPath+ "\\"+str, null);
                   
                }
                
              

                #endregion
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "DownloadAndExtractZipFile", "ctlScriptdesigner.xaml.cs");
                return -1;
            }
            #endregion
            return 0;
        }
Example #18
0
 void OpenBandwidthClient()
 {
     try
     {
         bhcFileTransfer = new BasicHttpClient();
         clientHttpChannelBandwidth = (IHttpFileUploadDownload)bhcFileTransfer.OpenClient<IHttpFileUploadDownload>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP + ":80/VMukti/HttpFileUploadDownload");
         clientHttpChannelBandwidth.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
     }
     catch (Exception ex)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "OpenBandwidthClient()", "pgHome.xaml.cs");
     }
 }
Example #19
0
        int DownloadAndExtractZipFile()
        {
            str = CRMName;
            str = str + "_CRM";

            //Retrives the Assembly of the Zip file.
            Assembly ass = Assembly.GetEntryAssembly();

            #region Downloading ZipFile

            //Set the Variable.
            filename = str + ".zip";

            //string strModPath = "";


            #region Download Zip File using WCF FileTranserService

            //Download file using WCF FileTransferService


            try
            {
                //Create object of the HTTP Client.
                BasicHttpClient bhcFts = new BasicHttpClient();

                //Open Client.
                clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient <IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");

                //Join the network.
                clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();

                //Create request to download File from Bootstrap.
                DownloadRequest request = new DownloadRequest();

                //Providing the information of the file that needs to download.
                RemoteFileInfo rfi = new RemoteFileInfo();
                request.FileName = filename;
                request.FolderWhereFileIsStored = "CRMs";

                //Calling the WCF Function for downloading the File.
                rfi = clientHttpFileTransfer.svcHTTPFileTransferServiceDownloadFile(request);


                //Checking for Directory Existence.
                //if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
                if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
                {
                    Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs"));
                }

                destination = ass.Location.Replace("VMukti.Presentation.exe", @"CRMs");

                //Checking for File Existance.
                if (File.Exists((destination + "\\" + filename)))
                {
                    File.Delete((destination + "\\" + filename));
                }

                filePath = destination + "\\" + filename;

                System.IO.Stream inputStream = rfi.FileByteStream;


                using (System.IO.FileStream writeStream = new System.IO.FileStream(filePath, System.IO.FileMode.CreateNew, System.IO.FileAccess.Write))
                {
                    int    chunkSize = 2048;
                    byte[] buffer    = new byte[chunkSize];

                    do
                    {
                        // read bytes from input stream
                        int bytesRead = inputStream.Read(buffer, 0, chunkSize);
                        if (bytesRead == 0)
                        {
                            break;
                        }

                        // write bytes to output stream
                        writeStream.Write(buffer, 0, bytesRead);
                    } while (true);

                    writeStream.Close();
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Download Zip: " + ex.Message);
                VMuktiHelper.ExceptionHandler(ex, "DownloadAndExtractZipFile()", "CtlCRMContainer.xaml.cs");
                if (ex.InnerException != null)
                {
                    //MessageBox.Show("Download Zip Inner Exception: " + ex.InnerException.Message);
                    VMuktiHelper.ExceptionHandler(ex, "DownloadAndExtractZipFile()", "CtlCRMContainer.xaml.cs");
                }
            }

            #endregion

            #region Downloading using Web Client --------Commented
            //try
            //{
            //    Uri u = new Uri("http://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + "/VMukti/CRMs/" + filename);
            //    if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
            //    {
            //        Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs"));
            //    }
            //    destination = ass.Location.Replace("VMukti.Presentation.exe", @"CRMs");
            //    if (!File.Exists(destination + "\\" + filename))
            //    {
            //        WebClient wc = new WebClient();
            //        try
            //        {
            //            wc.DownloadFile(u, destination + "\\" + filename);
            //        }
            //        catch (Exception exp)
            //        {
            //            MessageBox.Show(exp.Message);
            //        }
            //    }
            //}
            //catch (Exception exp)
            //{
            //    MessageBox.Show("Down Load Error - " + exp.Message);
            //}
            #endregion

            #endregion

            #region Extracting

            //Code for Extracting the .zip file.
            try
            {
                //Checking for the Existance of the Directory.

                if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMModules")))
                {
                    Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMModules"));
                }
                str = CRMName;
                str = str + "_CRM";
                Assembly ass2 = Assembly.GetEntryAssembly();
                strModPath = ass2.Location.Replace("VMukti.Presentation.exe", @"CRMModules");

                VMukti.ZipUnzip.Zip.FastZip fz = new VMukti.ZipUnzip.Zip.FastZip();
                //ICSharpCode.SharpZipLib.Zip.FastZip fz = new ICSharpCode.SharpZipLib.Zip.FastZip();

                //FastZip fz = new FastZip();
                //if (!Directory.Exists(strModPath + "\\" + filename.Split('.')[0]))
                //{
                try
                {
                    //Extracting the zip file.
                    fz.ExtractZip(destination + "\\" + filename, strModPath + "\\" + str, null);
                }
                catch (Exception exp)
                {
                    //MessageBox.Show(exp.Message + " First Desgine Required CRM Using CRMDesginer");
                    VMuktiHelper.ExceptionHandler(exp, "DownloadAndExtractZipFile()", "CtlCRMContainer.xaml.cs");
                }
                // }
            }
            catch (Exception exp)
            {
                VMuktiHelper.ExceptionHandler(exp, "DownloadAndExtractZipFile(Outer)", "CtlCRMContainer.xaml.cs");
                return(-1);
            }

            #endregion
            return(0);
        }
Example #20
0
		private void Dispose(bool disposing)
		{
           
			if (!this.disposed)
			{
				if (disposing)
				{
					try
					{
						if (chHttpBootStrapService != null)
						{
							chHttpBootStrapService = null;
						}
						if (objHttpBootStrap != null)
						{
							objHttpBootStrap = null;
						}

						if (App.chNetP2PSuperNodeChannel != null)
						{
							((NetPeerClient)App.objNetP2PSuperNode).CloseClient<INetP2PSuperNodeChannel>();
							App.chNetP2PSuperNodeChannel = null;
						}
						if (App.objNetP2PSuperNode != null)
						{
							App.objNetP2PSuperNode = null;
						}						
						if (chHttpSuperNodeService != null)
						{
							chHttpSuperNodeService = null;
						}
						if (objHttpSuperNode != null)
						{
							objHttpSuperNode = null;
						}
						if (objNetP2PSuperNode != null)
						{
							objNetP2PSuperNode = null;
						}
						if (chNetP2PSuperNodeChannel != null)
						{
							chNetP2PSuperNodeChannel = null;
						}
						
						if (DomainSetUp != null)
						{
							DomainSetUp = null;
						}
						if (thBootStrapDomain != null)
						{
							thBootStrapDomain = null;
						}
						if (thSuperNodeDomain != null)
						{
							thSuperNodeDomain = null;
						}
					}
					catch (Exception ex)
					{
                        VMuktiHelper.ExceptionHandler(ex, "Dispose()", "App.xaml.cs");
					}
				}
				disposed = true;
			}
			GC.SuppressFinalize(this);
		}
Example #21
0
        private void fncHostQAService(object lstParams)
        {
            try
            {
                List <object> lstTempObj = (List <object>)lstParams;
                strUri = lstTempObj[1].ToString();

                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcQA = new NetPeerClient();
                    ((clsNetTcpQA)objNetTcpQA).EntsvcP2PJoin          += new clsNetTcpQA.DelsvcP2Pjoin(ctlQA_EntsvcP2PJoin);
                    ((clsNetTcpQA)objNetTcpQA).EntsvcP2PAskQuestion   += new clsNetTcpQA.DelsvcP2PAskQuestion(ctlQA_EntsvcP2PAskQuestion);
                    ((clsNetTcpQA)objNetTcpQA).entsvcP2PReplyQuestion += new clsNetTcpQA.DelsvcP2PReplyQuestion(ctlQA_entsvcP2PReplyQuestion);
                    NetP2PChannel = (INetTcpQAChannel)npcQA.OpenClient <INetTcpQAChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[1], ref objNetTcpQA);
                    while (Counter < 20)
                    {
                        try
                        {
                            NetP2PChannel.svcP2PJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            Counter = 20;
                        }
                        catch
                        {
                            Counter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }
                else
                {
                    //DummyClient dc = new DummyClient();
                    //string httpuri = dc.QAClient(idCounter, strUri, VMukti.Global.VMuktiGlobal.strSuperNodeIP);

                    BasicHttpClient BasicQAClient = new BasicHttpClient();
                    HttpChannel = (IHttpQA)BasicQAClient.OpenClient <IHttpQA>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            HttpChannel.svcHttpJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);;
                            tempcounter = 20;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                    dt.Interval = TimeSpan.FromSeconds(2);
                    dt.Tick    += new EventHandler(dt_Tick);
                    dt.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("hostQAservice " + ex.Message);
                if (ex.InnerException != null)
                {
                    MessageBox.Show("hostQAservice" + ex.InnerException.Message);
                }
            }
        }
Example #22
0
        // ReSharper disable once InconsistentNaming
        public async Task <IHttpActionResult> OidcAuthResponseCallback(string tenant, string code = null, string state = null, string error = null, string error_description = null)
        {
            OpenIdConnectAuthorizationState authState = null;

            try
            {
                if (!string.IsNullOrWhiteSpace(error))
                {
                    return(BadRequest($"An error occurred during authorization. Error:{error}. Description:{error_description}"));
                }

                if (string.IsNullOrWhiteSpace(tenant))
                {
                    throw new WebArgumentNullException("tenant", "The tenant was not specified");
                }

                if (string.IsNullOrWhiteSpace(code))
                {
                    throw new WebArgumentNullException("code", "The code was not specified");
                }

                if (string.IsNullOrWhiteSpace(state))
                {
                    throw new WebArgumentNullException("state", "The state was not specified");
                }

                // For some reason ADFS is replacing the + signs (even the encoded ones) with spaces, so we undo it.
                // State is Base64 encoded so it should not contain spaces.
                if (!string.IsNullOrWhiteSpace(state))
                {
                    state = state.Replace(' ', '+');
                }

                var oidcLoginHandler = new OpenIdConnectLoginHandler(OpenIdConnectConfigurationManager);
                if (oidcLoginHandler.IsTokenValidationDisabled)
                {
                    EventLog.Application.WriteError("OpenIdConnectLoginHandler has token validation disabled. This is not be used in production.");
                    throw new AuthenticationException();
                }

                // Validate the state.
                authState = oidcLoginHandler.ValidateAuthState(state);

                using (var httpClient = new BasicHttpClient())
                {
                    // Process the authorization response.
                    var result = await oidcLoginHandler.ProcessOidcAuthorizationResponse(tenant, code, authState, new Uri(Request.RequestUri.GetLeftPart(UriPartial.Authority)), httpClient);

                    CookieHelper.CreateAuthenticationAndXsrfCookies(authState.TenantId, authState.IdentityProviderId, result.IdentityProviderUserName, result.RequestContextData.Identity.Id, true);
                }

                return(Redirect(authState.RedirectUrl));
            }
            catch (Exception exception)
            {
                var oidcConfigException = exception as OidcProviderInvalidConfigurationException;

                EventLog.Application.WriteError("Failed to process oidc authorization response. Error: {0}", exception.ToString());

                CookieHelper.DeleteAuthenticationAndXsrfCookies();
                if (!string.IsNullOrWhiteSpace(authState?.RedirectUrl))
                {
                    string delimiter = authState.RedirectUrl.Contains("?") ? "&" : "?";
                    string errorType = oidcConfigException != null ? "idpconfigerror" : "autherror";
                    return(Redirect(authState.RedirectUrl + delimiter + "error=" + errorType));
                }

                return(Unauthorized());
            }
        }
        public CtlUploadModule()
        {
            try
            {
                InitializeComponent();
                ass = Assembly.GetAssembly(typeof(CtlUploadModule));
                btnUpload.Click += new RoutedEventHandler(btnUpload_Click);
                btnBrowseMouleImage.Click += new RoutedEventHandler(btnBrowseMouleImage_Click);
                btnSubmit.Click += new RoutedEventHandler(btnSubmit_Click);
                btnCancel.Click += new RoutedEventHandler(btnCancel_Click);
                cmbAssembly.SelectionChanged += new SelectionChangedEventHandler(cmbAssembly_SelectionChanged);
                this.IsVisibleChanged += new DependencyPropertyChangedEventHandler(CtlUploadModule_IsVisibleChanged);
                BasicHttpClient bhcFiletransfer = new BasicHttpClient();
                clientHttpChannelFileTransfer = (IHTTPFileTransferService)bhcFiletransfer.OpenClient<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
                clientHttpChannelFileTransfer.svcHTTPFileTransferServiceJoin();

            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "CtlUploadModule()", "Controls\\CtlUploadModule.xaml.cs");
            }
        }
        int DownloadAndExtractZipFile()
        {
            str = CRMName;
                str = str + "_CRM";

                //Retrives the Assembly of the Zip file.
                Assembly ass = Assembly.GetEntryAssembly();

                #region Downloading ZipFile

                //Set the Variable.
                filename = str + ".zip";
                
                //string strModPath = "";


                #region Download Zip File using WCF FileTranserService

                //Download file using WCF FileTransferService
                

                try
                {
                    //Create object of the HTTP Client.
                    BasicHttpClient bhcFts = new BasicHttpClient();

                    //Open Client.
                    clientHttpFileTransfer = (IHTTPFileTransferService)bhcFts.OpenClient<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");

                    //Join the network.
                    clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();

                    //Create request to download File from Bootstrap.
                    DownloadRequest request = new DownloadRequest();

                    //Providing the information of the file that needs to download.
                    RemoteFileInfo rfi = new RemoteFileInfo();
                    request.FileName = filename;
                    request.FolderWhereFileIsStored = "CRMs";

                    //Calling the WCF Function for downloading the File.
                    rfi = clientHttpFileTransfer.svcHTTPFileTransferServiceDownloadFile(request);


                    //Checking for Directory Existence.
                    //if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
                    if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
                    {
                        Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs"));
                    }

                    destination = ass.Location.Replace("VMukti.Presentation.exe", @"CRMs");

                    //Checking for File Existance.
                    if (File.Exists((destination + "\\" + filename)))
                    {
                        File.Delete((destination + "\\" + filename));
                    }

                    filePath = destination + "\\" + filename;

                    System.IO.Stream inputStream = rfi.FileByteStream;


                    using (System.IO.FileStream writeStream = new System.IO.FileStream(filePath, System.IO.FileMode.CreateNew, System.IO.FileAccess.Write))
                    {
                        int chunkSize = 2048;
                        byte[] buffer = new byte[chunkSize];

                        do
                        {
                            // read bytes from input stream
                            int bytesRead = inputStream.Read(buffer, 0, chunkSize);
                            if (bytesRead == 0) break;

                            // write bytes to output stream
                            writeStream.Write(buffer, 0, bytesRead);

                        } while (true);

                        writeStream.Close();
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("Download Zip: " + ex.Message);
                    VMuktiHelper.ExceptionHandler(ex, "DownloadAndExtractZipFile()", "CtlCRMContainer.xaml.cs");
                    if (ex.InnerException != null)
                    {
                        //MessageBox.Show("Download Zip Inner Exception: " + ex.InnerException.Message);
                        VMuktiHelper.ExceptionHandler(ex, "DownloadAndExtractZipFile()", "CtlCRMContainer.xaml.cs");
                    }
                }

                #endregion

                #region Downloading using Web Client --------Commented
                //try
                //{
                //    Uri u = new Uri("http://" + VMuktiAPI.VMuktiInfo.BootStrapIPs[0] + "/VMukti/CRMs/" + filename);
                //    if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
                //    {
                //        Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs"));
                //    }
                //    destination = ass.Location.Replace("VMukti.Presentation.exe", @"CRMs");
                //    if (!File.Exists(destination + "\\" + filename))
                //    {
                //        WebClient wc = new WebClient();
                //        try
                //        {
                //            wc.DownloadFile(u, destination + "\\" + filename);
                //        }
                //        catch (Exception exp)
                //        {
                //            MessageBox.Show(exp.Message);
                //        }
                //    }
                //}
                //catch (Exception exp)
                //{
                //    MessageBox.Show("Down Load Error - " + exp.Message);
                //}
                #endregion

                #endregion

                #region Extracting

                //Code for Extracting the .zip file.
                try
                {
                    //Checking for the Existance of the Directory.

                    if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMModules")))
                    {
                        Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMModules"));
                    }
                    str = CRMName;
                    str = str + "_CRM";
                    Assembly ass2 = Assembly.GetEntryAssembly();
                    strModPath = ass2.Location.Replace("VMukti.Presentation.exe", @"CRMModules");

                    VMukti.ZipUnzip.Zip.FastZip fz = new VMukti.ZipUnzip.Zip.FastZip();
                    //ICSharpCode.SharpZipLib.Zip.FastZip fz = new ICSharpCode.SharpZipLib.Zip.FastZip();

                    //FastZip fz = new FastZip();
                    //if (!Directory.Exists(strModPath + "\\" + filename.Split('.')[0]))
                    //{
                        try
                        {
                            //Extracting the zip file.
                            fz.ExtractZip(destination + "\\" + filename, strModPath+"\\"+str, null);
                        }
                        catch (Exception exp)
                        {
                            //MessageBox.Show(exp.Message + " First Desgine Required CRM Using CRMDesginer");
                            VMuktiHelper.ExceptionHandler(exp, "DownloadAndExtractZipFile()", "CtlCRMContainer.xaml.cs");
                        }
                   // }
                }
                catch (Exception exp)
                {
                    VMuktiHelper.ExceptionHandler(exp, "DownloadAndExtractZipFile(Outer)", "CtlCRMContainer.xaml.cs");
                    return -1;
                }

                #endregion
                return 0;

        }
        void bgHostService_DoWork(object sender, DoWorkEventArgs e)
        {
            List<object> lstTempObj = (List<object>)e.Argument;
            strUri = lstTempObj[1].ToString();
            try
            {
                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcPresentation = new NetPeerClient();
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcJoin += new clsNetTcpPresentation.delsvcJoin(UserControl1_EntsvcJoin);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlide += new clsNetTcpPresentation.delsvcSetSlide(UserControl1_EntsvcSetSlide);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlideList += new clsNetTcpPresentation.delsvcSetSlideList(UserControl1_EntsvcSetSlideList);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcGetUserList += new clsNetTcpPresentation.delsvcGetUserList(UserControl1_EntsvcGetUserList);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetUserList += new clsNetTcpPresentation.delsvcSetUserList(UserControl1_EntsvcSetUserList);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSignOutPPT += new clsNetTcpPresentation.delsvcSignOutPPT(UserControl1_EntsvcSignOutPPT);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcUnJoin += new clsNetTcpPresentation.delsvcUnJoin(UserControl1_EntsvcUnJoin);

                    channelNetTcp = (INetTcpPresentationChannel)npcPresentation.OpenClient<INetTcpPresentationChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpPresentation);

                    while (temp < 20)
                    {
                        try
                        {
                            clsMessageContract objContract = new clsMessageContract();
                            objContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract.strMsg = "";
                            objContract.lstTo = new List<string>();
                            objContract.slideArr = new string[0];
                            objContract.SlideID = 0;
                            objContract.SlideStream = new MemoryStream();
                            channelNetTcp.svcJoin(objContract);

                            temp = 20;

                            clsMessageContract objContract1 = new clsMessageContract();
                            objContract1.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract1.strMsg = "get";
                            objContract1.lstTo = new List<string>();
                            objContract1.slideArr = new string[0];
                            objContract1.SlideID = 0;
                            objContract1.SlideStream = new MemoryStream();
                            channelNetTcp.svcGetUserList(objContract1);
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    ClsException.WriteToLogFile("Presentation module:");
                    ClsException.WriteToLogFile("Opened presenation P2P Client");
                    ClsException.WriteToLogFile("Uri for opening the client is : " + strUri);
                    ClsException.WriteToLogFile("MeshId for opening the client is : " + strUri.ToString().Split(':')[2].Split('/')[1]);
                }
                else
                {
                    BasicHttpClient bhcPresentation = new BasicHttpClient();
                    channelHttp = (IHttpPresentation)bhcPresentation.OpenClient<IHttpPresentation>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            clsMessageContract objContract = new clsMessageContract();
                            objContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract.strMsg = "";
                            objContract.lstTo = new List<string>();
                            objContract.slideArr = new string[0];
                            objContract.SlideID = 0;
                            objContract.SlideStream = new MemoryStream();
                            channelHttp.svcJoin(objContract);

                            tempcounter = 20;

                            clsMessageContract objContract1 = new clsMessageContract();
                            objContract1.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract1.strMsg = "get";
                            objContract1.lstTo = new List<string>();
                            objContract1.slideArr = new string[0];
                            objContract1.SlideID = 0;
                            objContract1.SlideStream = new MemoryStream();
                            channelHttp.svcGetUserList(objContract1);
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    dispTimerControl.Interval = TimeSpan.FromSeconds(2);
                    dispTimerControl.Tick += new EventHandler(dispTimerControl_Tick);
                    dispTimerControl.Start();

                    ClsException.WriteToLogFile("Presentation module:");
                    ClsException.WriteToLogFile("Opened Http Presentation Client with Timers");
                    ClsException.WriteToLogFile("Uri for opening the client is : " + strUri);
                    ClsException.WriteToLogFile("MeshId for opening the client is : " + strUri.ToString().Split(':')[2].Split('/')[1]);
                }


            }
            catch (System.Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "bgHostService_DoWork()", "UserControl1.xaml.cs");
            }
        }
        public void HostDesktopService(object lstParams)
        {
            try
            {
                List<object> lstTempObj = (List<object>)lstParams;
                strUri = lstTempObj[1].ToString();

                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcDesktop = new NetPeerClient();
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcJoin += new clsNetTcpDesktop.delsvcJoin(ctlDesktop_Sharing_EntsvcJoin);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSendMessage += new clsNetTcpDesktop.delsvcSendMessage(ctlDesktop_Sharing_EntsvcSendMessage);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcGetUserList += new clsNetTcpDesktop.delsvcGetUserList(ctlDesktop_Sharing_EntsvcGetUserList);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSetUserList += new clsNetTcpDesktop.delsvcSetUserList(ctlDesktop_Sharing_EntsvcSetUserList);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSelectedDesktop += new clsNetTcpDesktop.delsvcSelectedDesktop(ctlDesktop_Sharing_EntsvcSelectedDesktop);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcStopControl += new clsNetTcpDesktop.delsvcStopControl(ctlDesktop_Sharing_EntsvcStopControl);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSendXY += new clsNetTcpDesktop.delsvcSendXY(ctlDesktop_Sharing_EntsvcSendXY);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcBtnDown += new clsNetTcpDesktop.delsvcBtnDown(ctlDesktop_Sharing_EntsvcBtnDown);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcBtnUp += new clsNetTcpDesktop.delsvcBtnUp(ctlDesktop_Sharing_EntsvcBtnUp);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSendKey += new clsNetTcpDesktop.delsvcSendKey(ctlDesktop_Sharing_EntsvcSendKey);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcAllowView += new clsNetTcpDesktop.delsvcAllowView(ctlDesktop_Sharing_EntsvcAllowView);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcAllowControl += new clsNetTcpDesktop.delsvcAllowControl(ctlDesktop_Sharing_EntsvcAllowControl);
                    ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcUnJoin += new clsNetTcpDesktop.delsvcUnJoin(ctlDesktop_Sharing_EntsvcUnJoin);

                    channelNetTcp = (INetTcpDesktopChannel)npcDesktop.OpenClient<INetTcpDesktopChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpDesktop);

                    while (temp < 20)
                    {
                        try
                        {
                            #region MsgContract
                            clsMessageContract objMsgContract = new clsMessageContract();
                            objMsgContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objMsgContract.stremImage = new MemoryStream();
                            #endregion MsgContract
                            channelNetTcp.svcJoin(objMsgContract);
                            temp = 20;
                            #region MsgContract
                            clsMessageContract objContractGetUserList = new clsMessageContract();
                            objContractGetUserList.stremImage = new MemoryStream();
                            objContractGetUserList.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContractGetUserList.strType = "Get";
                            channelNetTcp.svcGetUserList(objContractGetUserList);
                            #endregion MsgContract
                            fncStartSendingImage();
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }
                else
                {
                    BasicHttpClient bhcDesktop = new BasicHttpClient();
                    bhcDesktop.NewBasicHttpBinding().TransferMode = TransferMode.Streamed;
                    channelHttp = (IHttpDesktop)bhcDesktop.OpenClient<IHttpDesktop>(strUri);
                    while (tempcounter < 20)
                    {
                        try
                        {
                             #region MsgContract
                            clsMessageContract objMsgContract = new clsMessageContract();
                            objMsgContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objMsgContract.stremImage = new MemoryStream();
                            #endregion MsgContract
                            channelHttp.svcJoin(objMsgContract);
                            tempcounter = 20;
                            #region MsgContract
                            clsMessageContract objContractGetUserList = new clsMessageContract();
                            objContractGetUserList.stremImage = new MemoryStream();
                            objContractGetUserList.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContractGetUserList.strType = "Get";
                            #endregion MsgContract                           
                            channelHttp.svcGetUserList(objContractGetUserList);
                            fncStartSendingImage();
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    dispTimer.Interval = TimeSpan.FromSeconds(2);
                    dispTimer.Tick += new EventHandler(dispTimer_Tick);
                    dispTimer.Start();
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "HostDesktopService", "ctlDesktop_Sharing.xaml.cs");
            }
        }
        private int downloadAndExtractZipFiles()
        {
            try
            {
                crm = CRMName;
                crm += "_CRM";
                Assembly ass = Assembly.GetEntryAssembly();
                filename = crm + ".zip";

                #region Download Zip File using WCF FileTranserService

                try
                {
                    BasicHttpClient bhcFtsj = new BasicHttpClient();
                    
                    clientHttpFileTransfer = (IHTTPFileTransferService)bhcFtsj.OpenClient<IHTTPFileTransferService>("http://" + VMuktiInfo.BootStrapIPs[0] + ":80/VMukti/HttpFileTransferService");
                    clientHttpFileTransfer.svcHTTPFileTransferServiceJoin();
                    DownloadRequest request = new DownloadRequest();
                    RemoteFileInfo rfi = new RemoteFileInfo();
                    request.FileName = filename;
                    request.FolderWhereFileIsStored = "CRMs";

                    

                    rfi = clientHttpFileTransfer.svcHTTPFileTransferServiceDownloadFile(request);

                    //rfi = clientHttpFileTransfer.svcHTTPFileTransferServiceDownloadFile(destination);
                    
                    //rfi=clientHttpFileTransfer.svcHTTPFileTransferServiceDownloadFile( ("D:\Users\KLS\CRMDesignerTestApplication\CRMDesigner_TestApplication\bin\Debug");

                    if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs")))
                    {
                        Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMs"));
                    }

                    destination = ass.Location.Replace("VMukti.Presentation.exe", @"CRMs");

                    filePath = destination + "\\" + filename;
                    System.IO.Stream inputStream = rfi.FileByteStream;

                    using (System.IO.FileStream writeStream = new System.IO.FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, FileShare.ReadWrite))
                    {
                        int chunkSize = 2048;
                        byte[] buffer = new byte[chunkSize];

                        do
                        {
                            // read bytes from input stream
                            int bytesRead = inputStream.Read(buffer, 0, chunkSize);
                            if (bytesRead == 0) break;

                            // write bytes to output stream
                            writeStream.Write(buffer, 0, bytesRead);

                        } while (true);
                        writeStream.Close();
                    }

                }
                catch (Exception ex)
                {
                    VMuktiHelper.ExceptionHandler(ex, "downloadAndExtractZipFiles(Download Zip File)", "ctlCRMDesigner.xaml.cs");
                    return -1;
                }
                #endregion


                #region Extracting


                if (!Directory.Exists(ass.Location.Replace("VMukti.Presentation.exe", @"CRMModules")))
                {
                    Directory.CreateDirectory(ass.Location.Replace("VMukti.Presentation.exe", @"CRMModules"));
                }

                try
                {
                    crm = CRMName;
                    crm += "_CRM";
                    Assembly ass2 = Assembly.GetEntryAssembly();
                    crmModPath = ass2.Location.Replace("VMukti.Presentation.exe", @"CRMModules");
                }
                catch (Exception ex)
                {
                    VMuktiHelper.ExceptionHandler(ex, "downloadAndExtractZipFiles(Extracting)", "ctlCRMDesigner.xaml.cs");
                }

                try
                {

                    VMukti.ZipUnzip.Zip.FastZip fz = new VMukti.ZipUnzip.Zip.FastZip();
                    //ICSharpCode.SharpZipLib.Zip.FastZip fz = new ICSharpCode.SharpZipLib.Zip.FastZip();


                    //if (!Directory.Exists(crmModPath + "\\" + crm))
                    {
                        //fz.ExtractZip(destination + "\\" + filename, crmModPath , null);
                        fz.ExtractZip(destination + "\\" + filename, crmModPath + "\\" + crm, null);
                    }
                }
                catch (Exception ex)
                {
                    VMuktiHelper.ExceptionHandler(ex, "downloadAndExtractZipFiles(creating zip)", "ctlCRMDesigner.xaml.cs");
                }
                
                
                #endregion

            }
            catch (Exception ex)
            {
                //VMuktiHelper.ExceptionHandler(ex, "downloadAndExtractZipFiles(Outer)", "ctlCRMDesigner.xaml.cs");
                return -1;
            }
            return 0;
        }
Example #28
0
        private void fncHostQAService(object lstParams)
        {
            try
            {
                List<object> lstTempObj = (List<object>)lstParams;
                strUri = lstTempObj[1].ToString();

                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcQA = new NetPeerClient();
                    ((clsNetTcpQA)objNetTcpQA).EntsvcP2PJoin += new clsNetTcpQA.DelsvcP2Pjoin(ctlQA_EntsvcP2PJoin);
                    ((clsNetTcpQA)objNetTcpQA).EntsvcP2PAskQuestion += new clsNetTcpQA.DelsvcP2PAskQuestion(ctlQA_EntsvcP2PAskQuestion);
                    ((clsNetTcpQA)objNetTcpQA).entsvcP2PReplyQuestion += new clsNetTcpQA.DelsvcP2PReplyQuestion(ctlQA_entsvcP2PReplyQuestion);
                    NetP2PChannel = (INetTcpQAChannel)npcQA.OpenClient<INetTcpQAChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[1], ref objNetTcpQA);
                    while (Counter < 20)
                    {
                        try
                        {
                            NetP2PChannel.svcP2PJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            Counter = 20;
                        }
                        catch
                        {
                            Counter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }
                else
                {
                    //DummyClient dc = new DummyClient();
                    //string httpuri = dc.QAClient(idCounter, strUri, VMukti.Global.VMuktiGlobal.strSuperNodeIP);

                    BasicHttpClient BasicQAClient = new BasicHttpClient();
                    HttpChannel = (IHttpQA)BasicQAClient.OpenClient<IHttpQA>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            HttpChannel.svcHttpJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);;
                            tempcounter = 20;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                    dt.Interval = TimeSpan.FromSeconds(2);
                    dt.Tick += new EventHandler(dt_Tick);
                    dt.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("hostQAservice " + ex.Message);
                if (ex.InnerException != null)
                {
                    MessageBox.Show("hostQAservice" + ex.InnerException.Message);
                }
            }
        }