private void Get_Data_User()
        {
            try
            {
                IMethods.Set_TextViewIcon("1", Txt_Username_icon, IonIcons_Fonts.Person);
                IMethods.Set_TextViewIcon("1", Txt_Email_icon, IonIcons_Fonts.Email);
                IMethods.Set_TextViewIcon("1", Txt_Gender_icon, IonIcons_Fonts.Male);

                var local = Classes.MyProfileList.FirstOrDefault(a => a.user_id == UserDetails.User_id);
                if (local != null)
                {
                    Txt_Username_text.Text = local.username;
                    Txt_Email_text.Text    = local.email;
                    Phone_number           = local.phone_number;

                    if (local.gender == "male" || local.gender == "Male")
                    {
                        RB_Male.Checked   = true;
                        RB_Female.Checked = false;
                        GenderStatus      = "male";
                    }
                    else
                    {
                        RB_Male.Checked   = false;
                        RB_Female.Checked = true;
                        GenderStatus      = "female";
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                _position = position;
                if (viewHolder is ProPages_AdapterViewHolder holder)
                {
                    var item = mProPagesList[_position];
                    if (item != null)
                    {
                        //Dont Remove this code #####
                        FontController.SetFont(holder.Name, 1);
                        IMethods.Set_TextViewIcon("1", holder.IconPage, IonIcons_Fonts.IosFlag);


                        if (holder.Image.Tag?.ToString() != "loaded")
                        {
                            ImageServiceLoader.Load_Image(holder.Image, "ImagePlacholder.jpg", item.avatar, 1);
                            holder.Image.Tag = "loaded";
                        }

                        string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(item.page_name));
                        holder.Name.Text = name;
                    }
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
        public void ListBoxItem_Dropping(object sender, DragEventArgs e)
        {
            try
            {
                TextBlock droppedData = e.Data.GetData(typeof(TextBlock)) as TextBlock;
                TextBlock target      = ((ListBoxItem)(sender)).DataContext as TextBlock;

                int removedIdx = ListBox.Items.IndexOf(droppedData);
                int targetIdx  = ListBox.Items.IndexOf(target);

                if (removedIdx < targetIdx)
                {
                    TextBlocks.Insert(targetIdx + 1, droppedData);
                    TextBlocks.RemoveAt(removedIdx);
                }
                else
                {
                    int remIdx = removedIdx + 1;
                    if (TextBlocks.Count + 1 > remIdx)
                    {
                        TextBlocks.Insert(targetIdx, droppedData);
                        TextBlocks.RemoveAt(remIdx);
                    }
                }


                CloseWindow();
                droppedData.ClearValue(EffectProperty);
                Mouse.SetCursor(Cursors.Arrow);
            }
            catch (Exception ex)
            {
                IMethods.WriteToErrorLog("DragAndDrop.cs => ListBoxItem_Dropping", ex.Message, user);
            }
        }
 public DragAndDrop(User _user, Grid _grid, double depthOfShadow = 4, double directionOfDropShadow = 315)
 {
     user = _user;
     try
     {
         DirectionOfDropShadow = directionOfDropShadow;
         DepthOfShadow         = depthOfShadow;
         Grid = _grid;
         System.Windows.Style gridStyle = new System.Windows.Style(typeof(Grid));
         WrapPanel = Grid.Parent as WrapPanel;
         System.Windows.Style wrapPanelStyle  = new System.Windows.Style(typeof(WrapPanel));
         System.Windows.Style mainWindowStyle = new System.Windows.Style(typeof(MainWindow));
         //wrapPanelStyle.Setters.Add(new EventSetter(WrapPanel.DropEvent, new DragEventHandler(Grid_Dropping)));
         mainWindowStyle.Setters.Add(new EventSetter(MainWindow.DropEvent, new DragEventHandler(Grid_Dropping)));
         gridStyle.Setters.Add(new Setter(Grid.AllowDropProperty, true));
         gridStyle.Setters.Add(new EventSetter(Grid.PreviewDragLeaveEvent, new DragEventHandler(Grid_PreviewDragLeave)));
         gridStyle.Setters.Add(new EventSetter(Grid.PreviewMouseMoveEvent, new MouseEventHandler(Grid_PreviewMouseMove)));
         //gridStyle.Setters.Add(new EventSetter(Grid.DropEvent, new DragEventHandler(Grid_Dropping)));
         gridStyle.Setters.Add(new EventSetter(Grid.GiveFeedbackEvent, new GiveFeedbackEventHandler(Grid_DraggingFeedback)));
         Grid.Style      = gridStyle;
         WrapPanel.Style = wrapPanelStyle;
         Application.Current.MainWindow.Style = mainWindowStyle;
     }
     catch (Exception ex)
     {
         IMethods.WriteToErrorLog("DragAndDrop.cs", ex.Message, user);
     }
 }
        public void ListBoxItem_DraggingFeedback(object sender, GiveFeedbackEventArgs e)
        {
            try
            {
                DraggedTextBlock = ((sender as ListBoxItem).Content) as TextBlock;
                if (e.Effects == DragDropEffects.Move)
                {
                    e.UseDefaultCursors = false;
                    Mouse.SetCursor(Cursors.SizeAll);
                    if (DragDropWindow == null)
                    {
                        CreateDragDropWindow(DraggedTextBlock);
                        DraggedTextBlock.Effect = new DropShadowEffect
                        {
                            Color = new Color {
                                A = 70, R = 0, G = 0, B = 0
                            },
                            Direction   = DirectionOfDropShadow,
                            ShadowDepth = DepthOfShadow,
                            Opacity     = .75,
                        };
                    }
                    else
                    {
                        Win32Point w32Mouse = new Win32Point();
                        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                        {
                            GetCursorPos(ref w32Mouse);
                        }
                        else
                        {
                            // How to do on Linux and OSX?
                        }

                        this.DragDropWindow.Left = w32Mouse.X;
                        this.DragDropWindow.Top  = w32Mouse.Y;
                    }
                }
                else if (e.Effects == DragDropEffects.None)
                {
                    if (CloseWindow())
                    {
                        foreach (UIElement uIElement in ListBox.Items)
                        {
                            uIElement.ClearValue(EffectProperty);
                        }
                        return;
                    }
                }
                else
                {
                    e.UseDefaultCursors = true;
                }
                e.Handled = true;
            }
            catch (Exception ex)
            {
                IMethods.WriteToErrorLog("DragAndDrop.cs => ListBoxItem_DraggingFeedback", ex.Message, user);
            }
        }
 public void ListBoxItem_PreviewMouseMove(object sender, MouseEventArgs e)
 {
     try
     {
         if (e.LeftButton == MouseButtonState.Pressed && sender is ListBoxItem)
         {
             ListBoxItem draggedItem = sender as ListBoxItem;
             TextBlock   textBlock   = draggedItem.Content as TextBlock;
             textBlock.Effect = new DropShadowEffect
             {
                 Color = new Color {
                     A = 70, R = 0, G = 0, B = 0
                 },
                 Direction   = DirectionOfDropShadow,
                 ShadowDepth = DepthOfShadow,
                 Opacity     = .75,
             };
             draggedItem.IsSelected = true;
             CreateDragDropWindow(textBlock);
             DragDrop.DoDragDrop(draggedItem, draggedItem.DataContext, DragDropEffects.Move);
         }
     }
     catch (Exception ex)
     {
         IMethods.WriteToErrorLog("DragAndDrop.cs => ListBoxItem_PreviewMouseMove", ex.Message, user);
     }
 }
Beispiel #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                }
                else
                {
                    Window.AddFlags(WindowManagerFlags.Fullscreen);
                    Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
                }

                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);


                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.View_Story_Layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.View_Story_Layout);
                }

                var datalist = JsonConvert.DeserializeObject <Get_Stories_Object.Story>(Intent.GetStringExtra("Story"));
                if (datalist != null)
                {
                    _Story_Data = datalist;
                }

                //Get values
                StoriesProgressViewDisplay = FindViewById <ProgressBar>(Resource.Id.storiesview);
                MainLayout       = FindViewById <RelativeLayout>(Resource.Id.storyDisplay);
                imagstoryDisplay = FindViewById <ImageViewAsync>(Resource.Id.imagstoryDisplay);

                storyaboutText   = FindViewById <TextView>(Resource.Id.storyaboutText);
                videoView        = FindViewById <VideoView>(Resource.Id.VideoView);
                UserProfileImage = FindViewById <ImageViewAsync>(Resource.Id.userImage);
                usernameText     = FindViewById <TextView>(Resource.Id.usernameText);
                Txt_LastSeen     = FindViewById <TextView>(Resource.Id.LastSeenText);
                CountStoryText   = FindViewById <TextView>(Resource.Id.CountStoryText);

                BackIcon = FindViewById <TextView>(Resource.Id.backicon);

                DeleteStory_Icon = FindViewById <TextView>(Resource.Id.DeleteIcon);
                IMethods.Set_TextViewIcon("1", DeleteStory_Icon, IonIcons_Fonts.TrashA);

                LoadingProgressBarview            = FindViewById <ProgressBar>(Resource.Id.loadingProgressBarview);
                LoadingProgressBarview.Visibility = ViewStates.Gone;
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
 private void Reorder_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int i = 1;
         foreach (TextBlock textBlock in textBlockList)
         {
             string from = directory + textBlock.Text + ".pdf";
             string to   = directory + i + "-" + textBlock.Text + ".pdf";
             File.Move(from, to);
             i++;
         }
         i = 1;
         foreach (string path in Directory.GetFiles(directory).OrderBy(s => s))
         {
             string name = System.IO.Path.GetFileNameWithoutExtension(path);
             string from = path;
             string to   = directory + name.Replace('-', '_') + ".pdf";
             File.Move(from, to);
             i++;
         }
     }
     catch (Exception ex)
     {
         IMethods.WriteToErrorLog("PDFOrderingWindow => Reorder_Click", ex.Message, user);
         MessageBox.Show(ex.Message);
     }
     this.Close();
 }
Beispiel #9
0
        private void WoDefaultClient_OnPageEventFinished(WebView view, string url)
        {
            try
            {
                swipeRefreshLayout.Refreshing = false;

                HybridController.EvaluateJavascript("$('.header-container').hide();");
                HybridController.EvaluateJavascript("$('.footer-wrapper').hide();");
                HybridController.EvaluateJavascript("$('.content-container').css('margin-top', '0');");
                HybridController.EvaluateJavascript("$('.wo_about_wrapper_parent').css('top', '0');");

                if (IMethods.CheckConnectivity())
                {
                    if (HybirdView.Visibility != ViewStates.Visible)
                    {
                        HybirdView.Visibility = ViewStates.Visible;
                        News_Empty.Visibility = ViewStates.Gone;
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Beispiel #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);

                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.Articles_Layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.Articles_Layout);
                }

                ArticlsRecylerView = (RecyclerView)FindViewById(Resource.Id.Recyler);
                Articls_Empty      = FindViewById <LinearLayout>(Resource.Id.Article_LinerEmpty);

                swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
                swipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight,
                                                           Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight,
                                                           Android.Resource.Color.HoloRedLight);
                swipeRefreshLayout.Refreshing = true;
                swipeRefreshLayout.Enabled    = true;

                Icon_Article = FindViewById <TextView>(Resource.Id.Article_icon);
                IMethods.Set_TextViewIcon("2", Icon_Article, "\uf15c");
                Icon_Article.SetTextColor(Color.ParseColor(Settings.MainColor));

                var ToolBar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (ToolBar != null)
                {
                    ToolBar.Title = GetText(Resource.String.Lbl_ExploreArticle);

                    SetSupportActionBar(ToolBar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                }

                ArticlesAdapter = new Articles_Adapter(this);

                mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);
                ArticlsRecylerView.SetLayoutManager(mLayoutManager);
                ArticlsRecylerView.SetAdapter(ArticlesAdapter);

                Articls_Empty.Visibility      = ViewStates.Gone;
                ArticlsRecylerView.Visibility = ViewStates.Visible;

                Get_Data_local();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Beispiel #11
0
 private void AddNoteToDate(DateTime dateTime, string note)
 {
     using var _nat02Context = new NAT02Context();
     try
     {
         // Exists
         if (_nat02Context.EoiCalendar.Any(c => c.Year == dateTime.Year && c.Month == dateTime.Month && c.Day == dateTime.Day))
         {
             EoiCalendar eoiCalendar = _nat02Context.EoiCalendar.First(c => c.Year == dateTime.Year && c.Month == dateTime.Month && c.Day == dateTime.Day);
             eoiCalendar.Notes     += System.Environment.NewLine + note;
             eoiCalendar.DomainName = user.DomainName;
             _nat02Context.SaveChanges();
         }
         else
         {
             EoiCalendar eoiCalendar = new EoiCalendar
             {
                 Year       = (Int16)dateTime.Year,
                 Month      = (byte)dateTime.Month,
                 Day        = (byte)dateTime.Day,
                 DomainName = user.DomainName,
                 Notes      = note
             };
             _nat02Context.EoiCalendar.Add(eoiCalendar);
             _nat02Context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("There was an error processing your request. It may have been parially processed" + System.Environment.NewLine + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         IMethods.WriteToErrorLog("RecurringEventWindow => AddNoteToDate => Date: " + dateTime.ToLongDateString() + " => Note: " + note, ex.Message, user);
     }
     _nat02Context.Dispose();
 }
Beispiel #12
0
        private void BtnUnBlockUserOnClick(object sender, EventArgs eventArgs)
        {
            try {
                if (IMethods.CheckConnectivity())
                {
                    var local = BlockedUsers_Activity.mAdapter.mBlockedUsers.FirstOrDefault(a =>
                                                                                            a.user_id == _Userid);
                    if (local != null)
                    {
                        BlockedUsers_Activity.mAdapter.Remove(local);
                    }

                    Toast.MakeText(Application.Context, GetString(Resource.String.Lbl_Unblock_successfully),
                                   ToastLength.Short).Show();

                    var data = Global.Block_User(_Userid, false).ConfigureAwait(false);   //false >> "un-block"
                }
                else
                {
                    Toast.MakeText(Context, GetString(Resource.String.Lbl_Error_check_internet_connection),
                                   ToastLength.Short).Show();
                }

                Dismiss();
                var x = Resource.Animation.slide_right;
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
Beispiel #13
0
 public SyntaxTestCaseBuilderCallPartialDirect(
     ICollection <IMethodSignature> signatures,
     IMethods methods)
 {
     this.signatures = signatures;
     this.methods    = methods;
 }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                double orderNumber = double.Parse(values[0].ToString());

                bool headerIsChecked = (bool)values[1];

                if (headerIsChecked)
                {
                    return(true);
                }

                if (parameter.ToString() == "Quote")
                {
                    return(((App)Application.Current).selectedQuotes.Any(o => o.Item1 == orderNumber.ToString()));
                }
                else if (parameter.ToString() == "Project")
                {
                    return(((App)Application.Current).selectedProjects.Any(o => o.Item1 == orderNumber.ToString()));
                }
                else //if (parameter.ToString() == "Order")
                {
                    //MessageBox.Show(orderNumber.ToString());
                    return(((App)Application.Current).selectedOrders.Any(o => o.Item1 == orderNumber.ToString()));
                }
            }
            catch (Exception ex)
            {
                IMethods.WriteToErrorLog("CheckBoxConverter", ex.Message, null);
            }

            return(false);
        }
        public static async Task GetStory_Api()
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    (int Api_status, var Respond) = await Client.Story.Get_Stories();

                    if (Api_status == 200)
                    {
                        if (Respond is Get_Stories_Object result)
                        {
                            if (result.stories.Length > 0)
                            {
                                //StoryAdapter.mStorylList = new ObservableCollection<Get_Stories_Object.Story>(result.stories);
                                //StoryAdapter.BindEnd();
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Beispiel #16
0
 static Tuple<string, TimeSpan>[] CheckPerformance<T>(IMethods<T> methods) where T:class
 {
   var stats = new List<Tuple<string, TimeSpan>>();
   T source = null;
   foreach (var info in new[] 
     { 
       new {Name = "Generate", Method = new Func<T, T>(items => methods.Generate(10000000, i => i % 2 == 0 ? -i : i))}, 
       new {Name = "Sum", Method =  new Func<T, T>(items => {Console.WriteLine(methods.Sum(items));return items;})}, 
       new {Name = "BlockCopy", Method = new Func<T, T>(items => methods.BlockCopy(items))}, 
       new {Name = "Sort", Method = new Func<T, T>(items => methods.BlockCopy(items))}, 
       new {Name = "Sum", Method =  new Func<T, T>(items => {Console.WriteLine(methods.Sum(items));return items;})}, 
     }
    )
   {
     int count = 10;
     var stopwatch = new Stopwatch();
     stopwatch.Start();
     T res = null;
     for (var i = 0; i < count; ++i)
       res = info.Method(source);
     stopwatch.Stop();
     source = res;
     stats.Add(new Tuple<string, TimeSpan>(info.Name, stopwatch.Elapsed));
   }
   return stats.ToArray();
 }
Beispiel #17
0
        private void BtnDeleteMessageOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                var local = Last_Messages_Fragment.mAdapter.MLastMessagesUser.FirstOrDefault(a =>
                                                                                             a.UserId == _Userid);
                if (local != null)
                {
                    Last_Messages_Fragment.mAdapter.Remove(local);


                    Task.Run(() =>
                    {
                        var dbDatabase = new SqLiteDatabase();
                        dbDatabase.Delete_LastUsersChat(_Userid);
                        dbDatabase.DeleteAllMessagesUser(UserDetails.User_id, _Userid);
                        dbDatabase.Dispose();
                    });
                }

                if (IMethods.CheckConnectivity())
                {
                    var data = Global.Delete_Conversation(_Userid).ConfigureAwait(false);
                }

                Last_Messages_Fragment.TimerWork = "Working";
                this.Dismiss();
                int x = Resource.Animation.slide_right;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #18
0
        public void Initialize(GroupsAdapterViewHolder holder, Get_Community_Object.Group item)
        {
            try
            {
                var AvatarSplit     = item.Avatar.Split('/').Last();
                var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskGroup, AvatarSplit);
                if (getImage_Avatar != "File Dont Exists")
                {
                    if (holder.Image.Tag?.ToString() != "loaded")
                    {
                        ImageServiceLoader.Load_Image(holder.Image, "no_profile_image.png", getImage_Avatar, 1);
                        holder.Image.Tag = "loaded";
                    }
                }
                else
                {
                    if (holder.Image.Tag?.ToString() != "loaded")
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskGroup, item.Avatar);
                        ImageServiceLoader.Load_Image(holder.Image, "no_profile_image.png", item.Avatar, 1);
                        holder.Image.Tag = "loaded";
                    }
                }

                IMethods.Set_TextViewIcon("1", holder.IconGroup, IonIcons_Fonts.PersonStalker);

                string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(item.GroupName));
                holder.Name.Text = IMethods.Fun_String.SubStringCutOf(name, 14);
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
        public AddPollAdapterViewHolder(View itemView, Action <AddPollAdapterClickEventArgs> clickListener, Action <AddPollAdapterClickEventArgs> CloseClickListener) : base(itemView)
        {
            try
            {
                MainView = itemView;
                var circel = (TextView)MainView.FindViewById(Resource.Id.bgcolor);
                Number      = (TextView)MainView.FindViewById(Resource.Id.number);
                Input       = (EditText)MainView.FindViewById(Resource.Id.text_input);
                CloseButton = (Button)MainView.FindViewById(Resource.Id.Close);

                Typeface font = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");
                CloseButton.SetTypeface(font, TypefaceStyle.Normal);
                CloseButton.Text        = IonIcons_Fonts.CloseRound;
                Input.AfterTextChanged += (sender, e) => clickListener(new AddPollAdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition, Text = Input.Text, Input = Input
                });
                IMethods.Set_TextViewIcon("1", circel, IonIcons_Fonts.Record);
                CloseButton.Click += (sender, e) => CloseClickListener(new AddPollAdapterClickEventArgs {
                    View = itemView, Position = AdapterPosition, Text = Input.Text
                });
                //Create an Event
                //itemView.Click += (sender, e) => clickListener(new AddPollAdapterClickEventArgs { View = itemView, Position = AdapterPosition });
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Beispiel #20
0
        public async Task RemoveData(string type)
        {
            try
            {
                SqLiteDatabase dbDatabase = new SqLiteDatabase();
                dbDatabase.DropAll();
                dbDatabase.ClearAll();
                dbDatabase.Dispose();

                Classes.ClearAllList();

                if (type == "Logout")
                {
                    IMethods.IPath.DeleteAll_MyFolderDisk();

                    if (IMethods.CheckConnectivity())
                    {
                        var data = await Client.Global.Get_Delete_Token().ConfigureAwait(false);
                    }
                }
                else
                {
                    IMethods.IPath.DeleteAll_MyFolder();
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Beispiel #21
0
 public void OnInput(MaterialDialog p0, ICharSequence p1)
 {
     try
     {
         if (TypeDialog == "Report")
         {
             if (p1.Length() > 0)
             {
                 if (IMethods.CheckConnectivity())
                 {
                     Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_received_your_report), ToastLength.Short).Show();
                 }
                 else
                 {
                     Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                 }
             }
             else
             {
                 Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_The_name_can_not_be_blank), ToastLength.Short).Show();
             }
         }
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);

                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.CreateEvent_Layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.CreateEvent_Layout);
                }

                var ToolBar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (ToolBar != null)
                {
                    ToolBar.Title = GetText(Resource.String.Lbl_Create_Events);

                    SetSupportActionBar(ToolBar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                }

                TxtEventName   = FindViewById <EditText>(Resource.Id.eventname);
                IconStartDate  = FindViewById <TextView>(Resource.Id.StartIcondate);
                TxtStartDate   = FindViewById <EditText>(Resource.Id.StartDateTextview);
                TxtStartTime   = FindViewById <EditText>(Resource.Id.StartTimeTextview);
                IconEndDate    = FindViewById <TextView>(Resource.Id.EndIcondate);
                TxtEndDate     = FindViewById <EditText>(Resource.Id.EndDateTextview);
                TxtEndTime     = FindViewById <EditText>(Resource.Id.EndTimeTextview);
                IconLocation   = FindViewById <TextView>(Resource.Id.IconLocation);
                TxtLocation    = FindViewById <EditText>(Resource.Id.LocationTextview);
                TxtDescription = FindViewById <EditText>(Resource.Id.description);

                ImageEvent = FindViewById <ImageViewAsync>(Resource.Id.EventCover);
                BtnImage   = FindViewById <Button>(Resource.Id.btn_selectimage);

                Txt_Add = FindViewById <TextView>(Resource.Id.toolbar_title);

                IMethods.Set_TextViewIcon("1", IconStartDate, IonIcons_Fonts.AndroidTime);
                IMethods.Set_TextViewIcon("1", IconEndDate, IonIcons_Fonts.AndroidTime);
                IMethods.Set_TextViewIcon("1", IconLocation, IonIcons_Fonts.Location);

                TxtStartTime.SetOnClickListener(this);
                TxtEndTime.SetOnClickListener(this);
                TxtStartDate.SetOnClickListener(this);
                TxtEndDate.SetOnClickListener(this);
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FileStorage.Portable.ViewModels.MapPageViewModel"/> class.
        /// </summary>
        /// <param name="navigation">Navigation.</param>
        /// <param name="commandFactory">Command factory.</param>
        public FilesPageViewModel(INavigationService navigation, Func <Action <object>, ICommand> commandFactory,
                                  IMethods methods, ISQLiteStorage storage, Func <FileItemViewModel> fileFactory)
            : base(navigation, methods)
        {
            DataChanges = new Subject <DataChange>();

            // retrieve main thread context
            _context     = SynchronizationContext.Current;
            _storage     = storage;
            _fileFactory = fileFactory;

            Cells = new ObservableCollection <FileItemViewModel>();

            _editFileCommand = commandFactory(async(file) =>
            {
                await Navigation.Navigate(PageNames.EditFilePage, new Dictionary <string, object>()
                {
                    { "filename", (file as FileItemViewModel).FileName },
                    { "contents", (file as FileItemViewModel).Contents }
                });
            });

            _createFileCommand = commandFactory(async(obj) =>
            {
                var fileName = await ShowEntryAlert("Enter file name:");

                if (!string.IsNullOrEmpty(fileName))
                {
                    await Navigation.Navigate(PageNames.EditFilePage, new Dictionary <string, object>()
                    {
                        { "filename", fileName }
                    });
                }
            });
        }
        public void OnInput(MaterialDialog p0, ICharSequence p1)
        {
            try
            {
                if (p1.Length() > 0)
                {
                    var strName = p1.ToString();

                    if (!IMethods.CheckConnectivity())
                    {
                        Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                       ToastLength.Short).Show();
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(PassedId))
                        {
                            var data = Client.Global.Post_Actions(PassedId, "commet", strName).ConfigureAwait(false);
                        }
                        else
                        {
                            Toast.MakeText(this, GetString(Resource.String.Lbl_something_went_wrong), ToastLength.Short)
                            .Show();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Beispiel #25
0
        public CoreRodWindow(Window owner, bool isEnabled,
                             bool coreRod, string coreRodSteelID,
                             bool coreRodKey, string coreRodKeySteelID,
                             bool coreRodKeyCollar, string coreRodKeyCollarSteelID,
                             bool coreRodPunch, string coreRodPunchSteelID)
        {
            Owner = owner;
            InitializeComponent();
            LowerCoreRod.IsChecked                   = coreRod;
            LowerCoreRodSteelID.Text                 = coreRodSteelID ?? "";
            LowerCoreRodKey.IsChecked                = coreRodKey;
            LowerCoreRodKeySteelID.Text              = coreRodKeySteelID ?? "";
            LowerCoreRodKeyCollar.IsChecked          = coreRodKeyCollar;
            LowerCoreRodKeyCollarSteelID.Text        = coreRodKeyCollarSteelID ?? "";
            LowerCoreRodPunch.IsChecked              = coreRodPunch;
            LowerCoreRodPunchSteelID.Text            = coreRodPunchSteelID ?? "";
            LowerCoreRodSteelID.ItemsSource          = IMethods.GetSteelIDItemsSource();
            LowerCoreRodKeySteelID.ItemsSource       = IMethods.GetSteelIDItemsSource();
            LowerCoreRodKeyCollarSteelID.ItemsSource = IMethods.GetSteelIDItemsSource();
            LowerCoreRodPunchSteelID.ItemsSource     = IMethods.GetSteelIDItemsSource();

            LowerCoreRodPunchSteelID.IsEnabled     = IsEnabled;
            LowerCoreRodPunch.IsEnabled            = IsEnabled;
            LowerCoreRodKeyCollarSteelID.IsEnabled = IsEnabled;
            LowerCoreRodKeyCollar.IsEnabled        = IsEnabled;
            LowerCoreRodKeySteelID.IsEnabled       = IsEnabled;
            LowerCoreRodKey.IsEnabled     = IsEnabled;
            LowerCoreRodSteelID.IsEnabled = IsEnabled;
            LowerCoreRod.IsEnabled        = IsEnabled;
            DoneButton.IsEnabled          = IsEnabled;
        }
Beispiel #26
0
        private static Tuple <string, TimeSpan>[] CheckPerformance <T>(IMethods <T> methods) where T : class
        {
            var stats = new List <Tuple <string, TimeSpan> >();

            T source = null;

            foreach (var info in new[]
            {
                new
                {
                    Name = "Generate",
                    Method = new Func <T, T>(items => methods.Generate(10000000, i => i % 2 == 0 ? (-i).ToString() : i.ToString()))
                },
            }
                     )
            {
                var count     = 10;
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                T res = null;
                for (var i = 0; i < count; ++i)
                {
                    res = info.Method(source);
                }
                stopwatch.Stop();
                source = res;
                stats.Add(new Tuple <string, TimeSpan>(info.Name, stopwatch.Elapsed));
            }
            return(stats.ToArray());
        }
Beispiel #27
0
        public static IMethods Get(int IndexMethod)
        {
            IMethods _methodprovider = null;

            switch (IndexMethod)
            {
            case 1:
                _methodprovider = new Metodo1();
                break;

            case 2:
                _methodprovider = new Metodo2();
                break;

            case 3:
                _methodprovider = new Metodo3();
                break;

            case 4:
                _methodprovider = new Metodo4();
                break;

            case 5:
                _methodprovider = new Metodo5();
                break;

            case 6:
                _methodprovider = new Metodo6();
                break;
            }

            return(_methodprovider);
        }
Beispiel #28
0
 public static IMethods[] GetCollectMethods()
 {
     IMethods[] methods = new IMethods[4];
     methods[0] = new MethodPlus();
     methods[1] = new MethodDivision();
     methods[2] = new MethodMinus();
     methods[3] = new MethodMultiplication();
     return(methods);
 }
 public SyntaxTestCaseBuilderWrapPartialsWithTryBlock(
     ICollection <IMethodSignature> signatures,
     IMethods methods,
     ITestFramework framework)
 {
     this.signatures = signatures;
     this.methods    = methods;
     this.framework  = framework;
 }
Beispiel #30
0
        //Get Data My Profile API
        public async void Get_MyProfileData_Api()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_Error_check_internet_connection),
                                   ToastLength.Short).Show();
                }
                else
                {
                    var(Api_status, Respond) = await Global.Get_User_Data(S_UserId);

                    if (Api_status == 200)
                    {
                        if (Respond is GetUserDataObject result)
                        {
                            var dbDatabase = new SqLiteDatabase();

                            //Add Data User
                            //=======================================
                            // user_data
                            if (result.user_data != null)
                            {
                                LoadDataUser(result.user_data);

                                dbDatabase.Insert_Or_Update_To_MyProfileTable(result.user_data);
                            }

                            dbDatabase.Dispose();
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is ErrorObject error)
                        {
                            var errortext = error._errors.Error_text;


                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Get_MyProfileData_Api();
            }
        }