예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.TheBestPlane);
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.AddDrawerListener(drawerToogle);
            drawerToogle.SyncState();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\ 
            Context context = Application.Context;
            var     id      = "ca-app-pub-8211072909515345~1945501010";

            Android.Gms.Ads.MobileAds.Initialize(context, id);
            var adView    = FindViewById <AdView>(Resource.Id.adViewTheBestPlane);
            var adRequest = new AdRequest.Builder().Build();

            adView.LoadAd(adRequest);
            //var requestbuilder = new AdRequest.Builder().AddTestDevice("D0BE22F1A4BE27C7470F95A699568FE2");
            //adView.LoadAd(requestbuilder.Build());

            _TheBestSpinnerNation = FindViewById <Spinner>(Resource.Id.TheBestSpinnerNation);
            _TheBestSpinnerRank   = FindViewById <Spinner>(Resource.Id.TheBestSpinnerRank);
            _TheBestSpinnerTask   = FindViewById <Spinner>(Resource.Id.TheBestSpinnerTask);
            _TheBestListView      = FindViewById <ListView>(Resource.Id.TheBestlistView);
            //Привязка спиннеров к шарп коду

            theBestNations                = NationCollection.GetNation();
            TheBestAdapterNation          = new NationAdapter(this, theBestNations);
            _TheBestSpinnerNation.Adapter = TheBestAdapterNation;
            _TheBestSpinnerNation.SetSelection(0);  //Автовыбор
            selectedNation = 100;

            theBestRanks                = RankCollection.GetRank();
            TheBestAdapterRank          = new RankAdapter(this, theBestRanks);
            _TheBestSpinnerRank.Adapter = TheBestAdapterRank;
            _TheBestSpinnerRank.SetSelection(6); //Автовыбор
            selectedRank = 6;                    //Автовыбор

            theBestTask                 = TaskCollection.GetTask();
            TheBestAdapterTask          = new TaskAdapter(this, theBestTask);
            _TheBestSpinnerTask.Adapter = TheBestAdapterTask;
            _TheBestSpinnerTask.SetSelection(0); //Автовыбор
            SelectedTask = 0;                    //Автовыбор


            _TheBestSpinnerNation.ItemSelected += _TheBestSpinnerNation_ItemSelected;
            _TheBestSpinnerRank.ItemSelected   += _TheBestSpinnerRank_ItemSelected;
            _TheBestSpinnerTask.ItemSelected   += _TheBestSpinnerTask_ItemSelected;
        }
예제 #2
0
        public void GetTaskDetails(Model.Task task)
        {
            TaskProxy   taskProxy   = new TaskProxy();
            TaskAdapter taskAdapter = new TaskAdapter();

            SelectedTask = taskAdapter.GetTask(taskProxy.GetTaskDetails(task.ID));
        }
예제 #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootView = inflater.Inflate (Resource.Layout.MainInbox, container, false);

            inboxList = rootView.FindViewById<ListView> (Resource.Id.InboxTaskList);
            taskAdapter = new TaskAdapter (inflater, ViewModel.Tasks);
            inboxList.Adapter = taskAdapter;

            inboxList.ItemClick += (sender, e) => {
                ViewModel.SelectTask(e.Position);
                if(ViewModel.SelectedTask != null) {
                    Intent intent = new Intent(rootView.Context, typeof(TaskEditActivity));
                    StartActivity(intent);
                }
            };

            inboxList.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) => {
                ViewModel.SelectTask(e.Position);
                ViewModel.StartSelectedTask();
                ViewModel.UnselectTask ();
                Activity.ActionBar.SetSelectedNavigationItem(0);
                Activity.InvalidateOptionsMenu();
            };

            return rootView;
        }
예제 #4
0
 public void GetUserTasks()
 {
     TaskProxy taskProxy = new TaskProxy();
     TaskAdapter taskAdapter = new TaskAdapter();
     tasks = taskAdapter.GetTasks(taskProxy.GetUserTasks("564ce3525e5ca90003000005", AuthenticationControl.AccessToken)).OrderBy(t => t.DeliveryDate).ToList();
     Tasks = new ObservableCollection<Model.Task>(tasks);
 }
예제 #5
0
        private async Task CurrentDateChanged()
        {
            // TODO: fix bug with null pointer at screen rotation!!!!!

            var showProgress = _taskProvider.UpdateNeeded;
            var progress     = new ProgressDialog(this);

            progress.SetTitle("Loading");
            progress.SetMessage("Please wait while loading tasks...");
            progress.SetCancelable(false);
            progress.SetCanceledOnTouchOutside(false);

            if (showProgress)
            {
                progress.Show();
            }

            var tasks = await GetTaskListForDateAsync();

            var elmaTasks = tasks as IList <IElmaTask> ?? tasks;
            var adapter   = new TaskAdapter(this, _currentDate, _taskProvider);

            _tasksListView.Adapter    = adapter;
            _currentDateTextView.Text = _currentDate.Date.ToShortDateString();
            UpdateWorklogTimeDisplays(elmaTasks);

            if (showProgress)
            {
                progress.Dismiss();
            }
        }
예제 #6
0
        protected override Task OnReceived(IRequest request, string connectionId, string data)
        {
            string                err        = string.Empty;
            Order                 order      = JsonConvert.DeserializeObject <Order>(data);
            TaskAdapter           ta         = new TaskAdapter();
            List <TaskOrderModel> taskOrders = new List <TaskOrderModel>();

            try
            {
                taskOrders = ta.Order2Task(order, ref err);
                if (string.IsNullOrEmpty(err))
                {
                    ta.SendTask2Group(taskOrders, Groups);
                    ResponseEntry re = new ResponseEntry();
                    re.T = "s";
                    re.D = data;
                    return(Groups.Send("Service", GetObjectJson(re)));
                }
                else
                {
                    throw new Exception(err);
                }
            }
            catch (Exception ex)
            {
                return(Connection.Send(connectionId, ex.Message));
            }
        }
예제 #7
0
        public void GetUserTasks()
        {
            TaskProxy   taskProxy   = new TaskProxy();
            TaskAdapter taskAdapter = new TaskAdapter();

            tasks = taskAdapter.GetTasks(taskProxy.GetUserTasks("564ce3525e5ca90003000005", AuthenticationControl.AccessToken)).OrderBy(t => t.DeliveryDate).ToList();
            Tasks = new ObservableCollection <Model.Task>(tasks);
        }
예제 #8
0
        public async Task Should_wait_for_result_of_itask()
        {
            ITask <int> t = new TaskAdapter <int>(() => 42);

            t.Start();

            (await t).Should().Be(42);
        }
예제 #9
0
        public async Task Should_wait_for_continuation_task()
        {
            ITask <int> t = new TaskAdapter <int>(() => 42);

            t.Start();
            t = t.ContinueWith(t2 => t2.Result + 1);

            (await t).Should().Be(43);
        }
예제 #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView1);

            var layoutManager = new LinearLayoutManager(this);

            recyclerView.SetLayoutManager(layoutManager);

            var tasks = new List <Task>()
            {
                new Task()
                {
                    Project  = "CS-101 Python,",
                    Exercise = "Exercise 1",
                    Topic    = "Data Structures 1",
                    Date     = new DateTime(2018, 1, 4),
                    DayLeft  = 3,
                    Time     = 30
                },
                new Task()
                {
                    Project  = "CS-101 Python,",
                    Exercise = "Exercise 2",
                    Topic    = "Data Structures 2",
                    Date     = new DateTime(2018, 1, 3),
                    DayLeft  = 2,
                    Time     = 35
                },
                new Task()
                {
                    Project  = "CS-101 Python,",
                    Exercise = "Exercise 3",
                    Topic    = "Data Structures 3",
                    Date     = new DateTime(2018, 1, 2),
                    DayLeft  = 1,
                    Time     = 40
                },
                new Task()
                {
                    Project  = "CS-101 Python,",
                    Exercise = "Exercise 4",
                    Topic    = "Data Structures 4",
                    Date     = new DateTime(2018, 1, 1),
                    DayLeft  = 0,
                    Time     = 45
                }
            };

            var adapter = new TaskAdapter(tasks);

            recyclerView.SetAdapter(adapter);
        }
예제 #11
0
        private async Task AddData(Controller ctrl, string projectId)
        {
            try
            {
                var output = await ctrl.GetTasks(Settings.GetInstance().Dataset, projectId);

                var listAdapter = new TaskAdapter(Activity, Android.Resource.Layout.SimpleListItem1, output.ToArray());
                ListView.Adapter = listAdapter;

                SetListShown(true);
                ListView.SetSelection(listAdapter.Count - 1);
                //ListView.SmoothScrollByOffset(listAdapter.Count -1);
                // ListView.SmoothScrollToPosition(listAdapter.Count - 1);
            }
            catch (CannotReachServerException)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("Unable to Connect")
                .SetMessage("Please check your network connection and try again")
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                    ((MainActivity)Activity).FragmentManager.PopBackStack();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (StatusNotOkayException se)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetMessage("Error :" + se.GetMessage())
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (Exception e)
            {
                // For any other weird exceptions
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetMessage("Error :" + e.Message)
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
        }
예제 #12
0
        public async Task Should_wait_for_taskadapter()
        {
            var executed = false;
            var t        = new TaskAdapter(() => executed = true);

            t.Start();

            await t;

            executed.Should().BeTrue();
        }
예제 #13
0
 /// <summary>
 /// 新增任务,及任务相关的表(任务指标映射表、任务型号映射表、任务生命周期表)
 /// </summary>
 /// <param name="task"></param>
 /// <param name="indicatorIdList"></param>
 public static void createTask(Tb_taskInfo task, List <int> indicatorIdList, Dictionary <int, List <int> > brandModelIdDic)
 {
     try
     {
         TaskAdapter.createTask(task, indicatorIdList, brandModelIdDic);
         list.Add(task);//更新任务信息缓存
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #14
0
        private void ReloadData(int startId)
        {
            m_AllTasks.Clear();
            foreach (var task in DataManager.GetTasks(Settings.SortBy))
            {
                m_AllTasks.Add(task);
            }


#if DEBUG
            if (m_AllTasks.Count == 0)
            {
                m_AllTasks = new JavaList <TaskModel>();
                foreach (var item in m_FakeData)
                {
                    var task = new TaskModel {
                        Task = item
                    };
                    task.ID = DataManager.SaveTask(task);
                    m_AllTasks.Add(task);
                }
            }
#endif
            RunOnUiThread(() =>
            {
                ListAdapter = new TaskAdapter(this, m_AllTasks);
                if (ListView.Visibility == ViewStates.Gone)
                {
                    ListView.Visibility = ViewStates.Visible;
                    ListView.StartAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.fadein));
                }
            });


            SetChecks();

            SetActionBar();

            if (startId == 0)
            {
                return;
            }

            var firstTask = m_AllTasks.FirstOrDefault(t => t.ID == startId);
            if (firstTask == null)
            {
                return;
            }

            var itemIndex = m_AllTasks.IndexOf(firstTask);
            RunOnUiThread(() => ListView.SetSelection(itemIndex));
        }
예제 #15
0
        public async void GetTask_Valid_NotNull_Test()
        {
            //Arrange
            const int idToRead = 0;
            _repositoryMock.Setup(r => r.Read(idToRead)).Returns(Task.FromResult(_storedTask));
            var taskAdapter = new TaskAdapter(_repositoryMock.Object);

            //Act
            var returnedTask = await taskAdapter.Read(idToRead);

            //Assert
            Assert.IsNotNull(returnedTask);
        }
예제 #16
0
        public async void GetTask_Valid_IsTask_Test()
        {
            //Arrange
            const int idToRead = 0;
            _repositoryMock.Setup(r => r.Read(idToRead)).Returns(Task.FromResult(_storedTask));
            var taskAdapter = new TaskAdapter(_repositoryMock.Object);

            //Act
            var returnedTask = await taskAdapter.Read(idToRead);

            //Assert
            Assert.IsInstanceOfType(returnedTask, typeof(TaskRequest));
        }
예제 #17
0
        public void CreateTask_Success_Test()
        {
            //Arrange 
            const int expectedReturnId = 0; 
            _repositoryMock.Setup(r => r.Create(_storedTask)).Returns(Task.FromResult(expectedReturnId));
            var taskAdapter = new TaskAdapter(_repositoryMock.Object);
            
            //Act
            var actualId = taskAdapter.Read(_storedTask.Id).Id;

            //Assert
            Assert.IsTrue(expectedReturnId == actualId);
        }
예제 #18
0
 protected override void Dispose(bool disposing)
 {
     if (this.disposed)
     {
         return;
     }
     if (!disposing)
     {
         return;
     }
     this.adapter?.Dispose();
     this.adapter = null;
     base.Dispose(true);
 }
예제 #19
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.fragment2, container, false);

            main           = (Activity as MainActivity);
            mTask2         = new task2();
            mRecyclerView  = view.FindViewById <RecyclerView>(Resource.Id.rvTasks);
            mLayoutManager = new LinearLayoutManager(view.Context);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            mTaskAdapter            = new TaskAdapter(mTask2, main);
            mTaskAdapter.itemClick += MAdapter_ItemClick;
            mRecyclerView.SetAdapter(mTaskAdapter);

            return(view);
        }
예제 #20
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootView = inflater.Inflate (Resource.Layout.MainNext, container, false);

            nextList = rootView.FindViewById<ListView> (Resource.Id.NextTaskList);
            taskAdapter = new TaskAdapter (inflater, ViewModel.Tasks);
            nextList.Adapter = taskAdapter;

            nextList.ItemClick += (sender, e) => {
                ViewModel.SelectTask(e.Position);
                if(ViewModel.SelectedTask != null) {
                    Intent intent = new Intent(rootView.Context, typeof(TaskInfoActivity));
                    StartActivity(intent);
                }
            };

            return rootView;
        }
예제 #21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.tasks_for_today);

            #region Висувний список та Action Bar

            mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar);
            SetSupportActionBar(mToolBar);

            mActionBar = SupportActionBar;
            mActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            mActionBar.SetHomeButtonEnabled(true);
            mActionBar.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (mNavigationView != null)
            {
                SetUpDrawerContent(mNavigationView);
            }

            #endregion

            tasksForTodayRecyclerView = FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.tasks_for_today_recycler_view);

            taskCardSimple = new TaskCardSimple();
            taskCardSimple.InitializeTasksForToday(this);

            adapter                      = new TaskAdapter(taskCardSimple.TaskCardSimpleList);
            adapter.ItemClick           += OnItemClick;
            adapter.SwitchClick         += Adapter_SwitchClick;
            adapter.ActionTextViewClick += Adapter_ActionTextViewClick;
            tasksForTodayRecyclerView.SetAdapter(adapter);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            tasksForTodayRecyclerView.SetLayoutManager(linearLayoutManager);
            tasksForTodayRecyclerView.NestedScrollingEnabled = false;
        }
예제 #22
0
        protected override void OnCreate(Bundle bundle)
        {
            SetTheme(Settings.ThemeSetting == 0 ? Resource.Style.MyTheme : Resource.Style.MyThemeDark);

            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            m_OriginalTheme  = Settings.ThemeSetting;
            m_OriginalAccent = Settings.ThemeAccent;

            Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);

            m_AllTasks         = new JavaList <TaskModel>();
            m_EditTaskPosition = 0;

            m_AddButton        = FindViewById <ImageButton>(Resource.Id.button_add_task);
            m_MicrophoneButton = FindViewById <ImageButton>(Resource.Id.button_microphone);
            m_TaskEditText     = FindViewById <EditText>(Resource.Id.edit_text_new_task);


            ActionBar = FindViewById <ActionBar.ActionBar>(Resource.Id.actionbar);

            //ActionBar.BackgroundDrawable = Resources.GetDrawable(Resource.Drawable.actionbar_background_blue);
            //ActionBar.ItemBackgroundDrawable = Resources.GetDrawable(Resource.Drawable.actionbar_btn_blue);
            //ActionBar.SeparatorColor = Resources.GetColor(Resource.Color.actionbar_separatorcolor_blue);
            ActionBar.Title           = "Tasks";
            ActionBar.CurrentActivity = this;
            ActionBar.SetHomeLogo(Resource.Drawable.ic_launcher);
            RegisterForContextMenu(ListView);


            m_TaskEditText.SetOnEditorActionListener(this);


            ListView.ChoiceMode = ChoiceMode.Multiple;

            m_AddButton.Click += (sender, args) => AddNewTask();

            m_AddButton.SetImageResource(Settings.ThemeSetting == 0 ? Resource.Drawable.ic_action_add : Resource.Drawable.ic_action_add_dark);
            m_MicrophoneButton.SetImageResource(Settings.ThemeSetting == 0 ? Resource.Drawable.ic_action_microphone : Resource.Drawable.ic_action_microphone_dark);

            m_AddButton.SetBackgroundResource(Settings.ImageButtonDrawable);
            m_MicrophoneButton.SetBackgroundResource(Settings.ImageButtonDrawable);

            // remove speech if it doesn't exist
            var activities = PackageManager.QueryIntentActivities(new Intent(RecognizerIntent.ActionRecognizeSpeech), 0);

            if (activities.Count == 0)
            {
                m_MicrophoneButton.Visibility = ViewStates.Gone;
            }
            else
            {
                m_MicrophoneButton.Click += (sender, args) => StartVoiceRecognitionActivity();
            }

            m_TextToSpeech = new TextToSpeech(this, this);

            var saveState = LastNonConfigurationInstance as SaveState;

            if (saveState != null)
            {
                m_AllTasks                      = new JavaList <TaskModel>(saveState.Tasks);
                ListView.Visibility             = ViewStates.Visible;
                RunOnUiThread(() => ListAdapter = new TaskAdapter(this, m_AllTasks));
                RunOnUiThread(() => ListView.SetSelection(saveState.LastPosition));
                SetChecks();
                m_TaskEditText.Text = saveState.NewTaskText;
                m_Editing           = saveState.Editing;
                m_EditTaskPosition  = saveState.EditIndex;
            }
            else
            {
                FlurryAgent.OnPageView();
                FlurryAgent.LogEvent("MainActivity");
                ReloadData(0);
            }

            SetActionBar();
            try
            {
                if (Intent.GetBooleanExtra("CameFromWidget", false))
                {
                    FocusMainText();
                    return;
                }

                if (Intent.Action == TaskWidgetProvider.UpdateIntent)
                {
                    if (Intent.ActionSend != Intent.Action || Intent.Type == null)
                    {
                        return;
                    }
                }

                if ("text/plain" != Intent.Type)
                {
                    return;
                }

                var sharedText = Intent.GetStringExtra(Intent.ExtraText);
                if (!string.IsNullOrEmpty(sharedText))
                {
                    m_TaskEditText.Text = sharedText;
                    m_Editing           = false;
                    SetActionBar();
                }
            }
            finally
            {
                var version = Resources.GetString(Resource.String.VersionNumber);
                if (Settings.CurrentVersionNumber != version)
                {
                    Settings.CurrentVersionNumber = version;
                    PopUpHelpers.ShowOKPopup(this, Resource.String.update_title, Resource.String.update_message, (ok) => { });
                }
            }
        }
예제 #23
0
        private async void LoadData(View v, Controller ctrl)
        {
            var pb = new ProgressDialog(_mActivity)
            {
                Indeterminate = true
            };

            pb.SetTitle("Loading");

            var recentTask = v.FindViewById <Button>(Resource.Id.Home_RecentTask);

            recentTask.Text = "Loading..";

            var recentProject = v.FindViewById <Button>(Resource.Id.Home_CurrentProject);

            recentProject.Text = "Loading..";
            pb.SetCanceledOnTouchOutside(false);
            pb.Show();
            try
            {
                var output = await ctrl.GetRecentTasks(Settings.GetInstance().Dataset);

                pb.Dismiss();

                var recent = output[0];

                recentTask.Text    = recent.FullName;
                recentProject.Text = recent.Project.Name;

                output.RemoveAt(0);

                if (_mActivity == null)
                {
                    Debug.WriteLine("Activity is null");
                }

                var listAdapter = new TaskAdapter(_mActivity, Android.Resource.Layout.SimpleListItem1, output.ToArray());
                ListAdapter = listAdapter;

                var refresher = v.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);

                refresher.Refresh += async delegate
                {
                    try
                    {
                        output = await ctrl.GetRecentTasks(Settings.GetInstance().Dataset);

                        recent = output[0];

                        recentTask.Text    = recent.FullName;
                        recentProject.Text = recent.Project.Name;

                        output.RemoveAt(0);
                        listAdapter = new TaskAdapter(_mActivity, Android.Resource.Layout.SimpleListItem1,
                                                      output.ToArray());
                        ListAdapter = listAdapter;

                        refresher.Refreshing = false;
                    }
                    catch (CannotReachServerException)
                    {
                        AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                        builder.SetTitle("Unable to Connect")
                        .SetMessage("Please check your network connection and try again")
                        .SetNeutralButton("Okay", (sender, args) =>
                        {
                            builder.Dispose();
                        })
                        .SetCancelable(false);
                        AlertDialog alert = builder.Create();
                        alert.Show();
                    }
                    catch (StatusNotOkayException se)
                    {
                        AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                        builder.SetTitle("An Error has occured")
                        .SetMessage("Error :" + se.GetMessage())
                        .SetNeutralButton("Okay", (sender, args) =>
                        {
                            builder.Dispose();
                        })
                        .SetCancelable(false);
                        AlertDialog alert = builder.Create();
                        alert.Show();
                    }
                    catch (Exception e)
                    {
                        // For any other weird exceptions
                        AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                        builder.SetTitle("An Error has occured")
                        .SetNeutralButton("Okay", (sender, args) =>
                        {
                            builder.Dispose();
                        })
                        .SetMessage("Error :" + e.Message)
                        .SetCancelable(false);
                        AlertDialog alert = builder.Create();
                        alert.Show();
                    }
                };

                recentProject.Click += (sender, args) =>
                {
                    ((MainActivity)Activity).ListOfProjectsCallback(recent.Project.Id, recent.Project.Name);
                };

                recentTask.Click += (sender, args) =>
                {
                    ((MainActivity)Activity).PassTaskDetailsInfo(recent.Id, recent.FullName, recent.Project.Name,
                                                                 recent.CompletionDate,
                                                                 recent.EstimatedTime, recent.ActualTime);
                };
            }
            catch (CannotReachServerException)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("Unable to Connect")
                .SetMessage("Please check your network connection and try again")
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (StatusNotOkayException se)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetMessage("Error :" + se.GetMessage())
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (Exception e)
            {
                // For any other weird exceptions
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetMessage("Error :" + e.Message)
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }

            /*
             *  private void LoadDummyData(View v)
             *  {
             *
             *      ListView lv = v.FindViewById<ListView>(Android.Resource.Id.List);
             *      var items = new[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
             *      ArrayAdapter listAdapter = new ArrayAdapter<String>(_mActivity, Android.Resource.Layout.SimpleListItem1, items);
             *      ListAdapter = listAdapter;
             *
             *      TextView recentTask = v.FindViewById<TextView>(Resource.Id.Home_RecentTask);
             *      recentTask.Text = "Project / Mobile App l1 / Iteration 1 / View Skeletons / Create Android Skeletons / Home Screen ";
             *
             *  }
             */
        }
예제 #24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.InfoTank);
            context = Application.Context;
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.AddDrawerListener(drawerToogle);
            drawerToogle.SyncState();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            var id = "ca-app-pub-8211072909515345~1945501010";

            Android.Gms.Ads.MobileAds.Initialize(context, id);
            var adView    = FindViewById <AdView>(Resource.Id.adViewInfoTankkk);
            var adRequest = new AdRequest.Builder().Build();

            adView.LoadAd(adRequest);
            //var requestbuilder = new AdRequest.Builder().AddTestDevice("D0BE22F1A4BE27C7470F95A699568FE2");
            //adView.LoadAd(requestbuilder.Build());
            //шрифт
            var font = Typeface.CreateFromAsset(Assets, "dinfont.ttf");

            _InfoSpinnerNation             = FindViewById <Spinner>(Resource.Id.InfoSpinnerNationT);
            _InfoSpinnerRank               = FindViewById <Spinner>(Resource.Id.InfoSpinnerRankT);
            _InfoSpinnerTank               = FindViewById <Spinner>(Resource.Id.InfoSpinnerTank);
            _InfoListView                  = FindViewById <ListView>(Resource.Id.listViewT);
            _InfoSpinnerPotentialEnemyTank = FindViewById <Spinner>(Resource.Id.InfoSpinnerPotentialEnemyTank);
            //Привязка спиннеров к шарп коду

            #region Привязка TextView к коду
            _InfoImage = FindViewById <ImageView>(Resource.Id.InfoImageT);
            _InfoFlag  = FindViewById <ImageView>(Resource.Id.InfoFlagT);

            _ShellAP          = FindViewById <ImageView>(Resource.Id.InfoShellAP);
            _ShellAPHE        = FindViewById <ImageView>(Resource.Id.InfoShellAPHE);
            _ShellHE          = FindViewById <ImageView>(Resource.Id.InfoShellHE);
            _ShellAPCR        = FindViewById <ImageView>(Resource.Id.InfoShellAPCR);
            _ShellAPDS        = FindViewById <ImageView>(Resource.Id.InfoShellAPDS);
            _ShellAPFSDS      = FindViewById <ImageView>(Resource.Id.InfoShellAPFSDS);
            _ShellHEAT        = FindViewById <ImageView>(Resource.Id.InfoShellHEAT);
            _ShellHEATFS      = FindViewById <ImageView>(Resource.Id.InfoShellHEATFS);
            _ShellShrapnel    = FindViewById <ImageView>(Resource.Id.InfoShellShrapnel);
            _ShellHESH        = FindViewById <ImageView>(Resource.Id.InfoShellHESH);
            _ShellATGM        = FindViewById <ImageView>(Resource.Id.InfoShellATGM);
            _ShellSSM         = FindViewById <ImageView>(Resource.Id.InfoShellSSM);
            _ShellHEATGRENADE = FindViewById <ImageView>(Resource.Id.InfoShellHEATGRENADE);
            _ShellHEGRENADE   = FindViewById <ImageView>(Resource.Id.InfoShellHEGRENADE);
            _ShellHEVT        = FindViewById <ImageView>(Resource.Id.InfoShellHEVT);
            _ShellSAM         = FindViewById <ImageView>(Resource.Id.InfoShellSAM);



            _InfoTankTextBR                      = FindViewById <TextView>(Resource.Id.InfoTankTextBR);
            _InfoTankTextType                    = FindViewById <TextView>(Resource.Id.InfoTankTextType);
            _InfoTankTextCharacter               = FindViewById <TextView>(Resource.Id.InfoTankTextPlaneCharacter);
            _InfoTankTextFirstRideYear           = FindViewById <TextView>(Resource.Id.InfoTankTextFirstRideYear);
            _InfoTankTextPatchAdded              = FindViewById <TextView>(Resource.Id.InfoTankTextPatchAdded);
            _InfoTankTextMaxSpeedAtRoad          = FindViewById <TextView>(Resource.Id.InfoTankTextMaxSpeedAtRoad);
            _InfoTankTextMaxSpeedAtTerrain       = FindViewById <TextView>(Resource.Id.InfoTankTextMaxSpeedAtTerrain);
            _InfoTankTextMaxReverseSpeed         = FindViewById <TextView>(Resource.Id.InfoTankTextMaxReverseSpeed);
            _InfoTankTextAccelerationTo100       = FindViewById <TextView>(Resource.Id.InfoTankTextAccelerationTo100);
            _InfoTankTextTurnTurretTime          = FindViewById <TextView>(Resource.Id.InfoTankTextTurnTurretTime);
            _InfoTankTextTurnHullTime            = FindViewById <TextView>(Resource.Id.InfoTankTextTurnHullTime);
            _InfoTankTextEnginePower             = FindViewById <TextView>(Resource.Id.InfoTankTextEnginePower);
            _InfoTankTextWeight                  = FindViewById <TextView>(Resource.Id.InfoTankTextWeight);
            _InfoTankTextPowerToWeightRatio      = FindViewById <TextView>(Resource.Id.InfoTankTextPowerToWeightRatio);
            _InfoTankTextCannonName              = FindViewById <TextView>(Resource.Id.InfoTankTextCannonName);
            _InfoTankTextPenetration             = FindViewById <TextView>(Resource.Id.InfoTankTextPenetration);
            _InfoTankTextShellSpeed              = FindViewById <TextView>(Resource.Id.InfoTankTextShellSpeed);
            _InfoTankTextReloadTime              = FindViewById <TextView>(Resource.Id.InfoTankTextReloadTime);
            _InfoTankTextUpAimAngle              = FindViewById <TextView>(Resource.Id.InfoTankTextUpAimAngle);
            _InfoTankTextDownAimAngle            = FindViewById <TextView>(Resource.Id.InfoTankTextDownAimAngle);
            _InfoTankTextStabilizer              = FindViewById <TextView>(Resource.Id.InfoTankTextStabilizer);
            _InfoTankTextAAMachineGunExist       = FindViewById <TextView>(Resource.Id.InfoTankTextAAMachineGunExist);
            _InfoTankTextReducedArmorFrontTurret = FindViewById <TextView>(Resource.Id.InfoTankTextReducedArmorFrontTurret);
            _InfoTankTextReducedArmorTopSheet    = FindViewById <TextView>(Resource.Id.InfoTankTextReducedArmorTopSheet);
            _InfoTankTextReducedArmorBottomSheet = FindViewById <TextView>(Resource.Id.InfoTankTextReducedBottomTopSheet);

            _InfoTankLabelTextBR                      = FindViewById <TextView>(Resource.Id.InfoTankLabelTextBR);
            _InfoTankLabelTextType                    = FindViewById <TextView>(Resource.Id.InfoTankLabelTextType);
            _InfoTankLabelTextCharacter               = FindViewById <TextView>(Resource.Id.InfoTankLabelTextPlaneCharacter);
            _InfoTankLabelTextFirstRideYear           = FindViewById <TextView>(Resource.Id.InfoTankLabelTextFirstRideYear);
            _InfoTankLabelTextPatchAdded              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextTankPatchAdded);
            _InfoTankLabelTextMaxSpeedAtRoad          = FindViewById <TextView>(Resource.Id.InfoTankLabelTextMaxSpeedAtRoad);
            _InfoTankLabelTextMaxSpeedAtTerrain       = FindViewById <TextView>(Resource.Id.InfoTankLabelTextMaxSpeedAtTerrain);
            _InfoTankLabelTextMaxReverseSpeed         = FindViewById <TextView>(Resource.Id.InfoTankLabelTextMaxReverseSpeed);
            _InfoTankLabelTextAccelerationTo100       = FindViewById <TextView>(Resource.Id.InfoTankLabelTextAccelerationTo100);
            _InfoTankLabelTextTurnTurretTime          = FindViewById <TextView>(Resource.Id.InfoTankLabelTextTurnTurretTime);
            _InfoTankLabelTextTurnHullTime            = FindViewById <TextView>(Resource.Id.InfoTankLabelTextTurnHullTime);
            _InfoTankLabelTextEnginePower             = FindViewById <TextView>(Resource.Id.InfoTankLabelTextEnginePower);
            _InfoTankLabelTextWeight                  = FindViewById <TextView>(Resource.Id.InfoTankLabelTextWeight);
            _InfoTankLabelTextPowerToWeightRatio      = FindViewById <TextView>(Resource.Id.InfoTankLabelTextPowerToWeightRatio);
            _InfoTankLabelTextPenetration             = FindViewById <TextView>(Resource.Id.InfoTankLabelTextPenetration);
            _InfoTankLabelTextShellSpeed              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextShellSpeed);
            _InfoTankLabelTextReloadTime              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReloadTime);
            _InfoTankLabelTextUpAimAngle              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextUpAimAngle);
            _InfoTankLabelTextDownAimAngle            = FindViewById <TextView>(Resource.Id.InfoTankLabelTextDownAimAngle);
            _InfoTankLabelTextStabilizer              = FindViewById <TextView>(Resource.Id.InfoTankLabelTextStabilizer);
            _InfoTankLabelTextAAMachineGunExist       = FindViewById <TextView>(Resource.Id.InfoTankLabelTextAAMachineGunExist);
            _InfoTankLabelTextReducedArmorFrontTurret = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReducedArmorFrontTurret);
            _InfoTankLabelTextReducedArmorTopSheet    = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReducedArmorTopSheet);
            _InfoTankLabelTextReducedArmorBottomSheet = FindViewById <TextView>(Resource.Id.InfoTankLabelTextReducedArmorBottomSheet);
            _InfoTankShellType = FindViewById <TextView>(Resource.Id.InfoTankShellType);
            #endregion

            #region Изменения шрифта

            _InfoTankLabelTextBR.Typeface                      = font;
            _InfoTankLabelTextType.Typeface                    = font;
            _InfoTankLabelTextCharacter.Typeface               = font;
            _InfoTankLabelTextFirstRideYear.Typeface           = font;
            _InfoTankLabelTextPatchAdded.Typeface              = font;
            _InfoTankLabelTextMaxSpeedAtRoad.Typeface          = font;
            _InfoTankLabelTextMaxSpeedAtTerrain.Typeface       = font;
            _InfoTankLabelTextMaxReverseSpeed.Typeface         = font;
            _InfoTankLabelTextAccelerationTo100.Typeface       = font;
            _InfoTankLabelTextTurnTurretTime.Typeface          = font;
            _InfoTankLabelTextTurnHullTime.Typeface            = font;
            _InfoTankLabelTextEnginePower.Typeface             = font;
            _InfoTankLabelTextWeight.Typeface                  = font;
            _InfoTankLabelTextPowerToWeightRatio.Typeface      = font;
            _InfoTankLabelTextPenetration.Typeface             = font;
            _InfoTankLabelTextShellSpeed.Typeface              = font;
            _InfoTankLabelTextReloadTime.Typeface              = font;
            _InfoTankLabelTextUpAimAngle.Typeface              = font;
            _InfoTankLabelTextDownAimAngle.Typeface            = font;
            _InfoTankLabelTextStabilizer.Typeface              = font;
            _InfoTankLabelTextAAMachineGunExist.Typeface       = font;
            _InfoTankLabelTextReducedArmorFrontTurret.Typeface = font;
            _InfoTankLabelTextReducedArmorTopSheet.Typeface    = font;
            _InfoTankLabelTextReducedArmorBottomSheet.Typeface = font;
            _InfoTankShellType.Typeface = font;

            #endregion

            #region Изменения цвета текста всех TextView


            _InfoTankLabelTextBR.SetTextColor(Color.Black);
            _InfoTankLabelTextType.SetTextColor(Color.Black);
            _InfoTankLabelTextCharacter.SetTextColor(Color.Black);
            _InfoTankLabelTextFirstRideYear.SetTextColor(Color.Black);
            _InfoTankLabelTextPatchAdded.SetTextColor(Color.Black);
            _InfoTankLabelTextMaxSpeedAtRoad.SetTextColor(Color.Black);
            _InfoTankLabelTextMaxSpeedAtTerrain.SetTextColor(Color.Black);
            _InfoTankLabelTextMaxReverseSpeed.SetTextColor(Color.Black);
            _InfoTankLabelTextAccelerationTo100.SetTextColor(Color.Black);
            _InfoTankLabelTextTurnTurretTime.SetTextColor(Color.Black);
            _InfoTankLabelTextTurnHullTime.SetTextColor(Color.Black);
            _InfoTankLabelTextEnginePower.SetTextColor(Color.Black);
            _InfoTankLabelTextWeight.SetTextColor(Color.Black);
            _InfoTankLabelTextPowerToWeightRatio.SetTextColor(Color.Black);
            _InfoTankLabelTextPenetration.SetTextColor(Color.Black);
            _InfoTankLabelTextShellSpeed.SetTextColor(Color.Black);
            _InfoTankLabelTextReloadTime.SetTextColor(Color.Black);
            _InfoTankLabelTextUpAimAngle.SetTextColor(Color.Black);
            _InfoTankLabelTextDownAimAngle.SetTextColor(Color.Black);
            _InfoTankLabelTextStabilizer.SetTextColor(Color.Black);
            _InfoTankLabelTextAAMachineGunExist.SetTextColor(Color.Black);
            _InfoTankLabelTextReducedArmorFrontTurret.SetTextColor(Color.Black);
            _InfoTankLabelTextReducedArmorTopSheet.SetTextColor(Color.Black);
            _InfoTankLabelTextReducedArmorBottomSheet.SetTextColor(Color.Black);

            _InfoTankTextBR.SetTextColor(Color.Black);
            _InfoTankTextType.SetTextColor(Color.Black);
            _InfoTankTextCharacter.SetTextColor(Color.Black);
            _InfoTankTextFirstRideYear.SetTextColor(Color.Black);
            _InfoTankTextPatchAdded.SetTextColor(Color.Black);
            _InfoTankTextMaxSpeedAtRoad.SetTextColor(Color.Black);
            _InfoTankTextMaxSpeedAtTerrain.SetTextColor(Color.Black);
            _InfoTankTextMaxReverseSpeed.SetTextColor(Color.Black);
            _InfoTankTextAccelerationTo100.SetTextColor(Color.Black);
            _InfoTankTextTurnTurretTime.SetTextColor(Color.Black);
            _InfoTankTextTurnHullTime.SetTextColor(Color.Black);
            _InfoTankTextEnginePower.SetTextColor(Color.Black);
            _InfoTankTextWeight.SetTextColor(Color.Black);
            _InfoTankTextPowerToWeightRatio.SetTextColor(Color.Black);
            _InfoTankTextCannonName.SetTextColor(Color.Black);
            _InfoTankTextPenetration.SetTextColor(Color.Black);
            _InfoTankTextShellSpeed.SetTextColor(Color.Black);
            _InfoTankTextReloadTime.SetTextColor(Color.Black);
            _InfoTankTextUpAimAngle.SetTextColor(Color.Black);
            _InfoTankTextDownAimAngle.SetTextColor(Color.Black);
            _InfoTankTextStabilizer.SetTextColor(Color.Black);
            _InfoTankTextAAMachineGunExist.SetTextColor(Color.Black);
            _InfoTankTextReducedArmorFrontTurret.SetTextColor(Color.Black);
            _InfoTankTextReducedArmorTopSheet.SetTextColor(Color.Black);
            _InfoTankTextReducedArmorBottomSheet.SetTextColor(Color.Black);
            _InfoTankShellType.SetTextColor(Color.Black);

            #endregion

            nations       = NationCollection.GetNation();
            AdapterNation = new NationAdapter(this, nations);
            _InfoSpinnerNation.Adapter = AdapterNation;
            _InfoSpinnerNation.SetSelection(5); //Автовыбор
            selectedNation = 5;                 //Автовыбор

            ranks       = RankCollection.GetRank();
            AdapterRank = new RankAdapter(this, ranks);
            _InfoSpinnerRank.Adapter = AdapterRank;
            _InfoSpinnerRank.SetSelection(7); //Автовыбор
            selectedRank = 7;                 //Автовыбор

            potentialTask        = TankTaskCollection.GetTankTask();
            PotentialAdapterTask = new TaskAdapter(this, potentialTask);
            _InfoSpinnerPotentialEnemyTank.Adapter = PotentialAdapterTask;
            _InfoSpinnerPotentialEnemyTank.SetSelection(0); //Автовыбор
            SelectedPotentialTask = 0;                      //Автовыбор

            _InfoSpinnerTank.SetSelection(1);
            //Объявление коллекции наций, рангов и адаптеров

            _InfoSpinnerNation.ItemSelected             += _InfoSpinnerNation_ItemSelected;
            _InfoSpinnerRank.ItemSelected               += _InfoSpinnerRank_ItemSelected;
            _InfoSpinnerTank.ItemSelected               += _InfoSpinnerTank_ItemSelected;
            _InfoSpinnerPotentialEnemyTank.ItemSelected += _InfoSpinnerPotentialEnemyTank_ItemSelected;    //**//
        }
예제 #25
0
 public TaskRepository(IProgressConnection connection)
 {
     this.adapter = new TaskAdapter(connection);
     this.Cono    = this.adapter.Cono;
     this.OnCreated();
 }
예제 #26
0
        public async void GetTask_Valid_CorrectTaskInfo_Test()
        {
            //Arrange
            const int idToRead = 0;
            _repositoryMock.Setup(r => r.Read(idToRead)).Returns(Task.FromResult(_storedTask));
            var adapter = new TaskAdapter(_repositoryMock.Object);

            //Act
            var actualTask = await adapter.Read(idToRead);
            
            //Assert
            Assert.IsTrue(_task.Id == actualTask.Id);
            Assert.IsTrue(_task.Description == actualTask.Description);
            // TODO add more? 

        }
예제 #27
0
 public void GetTaskDetails(Model.Task task)
 {
     TaskProxy taskProxy = new TaskProxy();
     TaskAdapter taskAdapter = new TaskAdapter();
     SelectedTask = taskAdapter.GetTask(taskProxy.GetTaskDetails(task.ID));
 }
예제 #28
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            string jsonData = Intent.GetStringExtra("JSON") ?? "";

            learningActivity = JsonConvert.DeserializeObject <LearningActivity>(jsonData,
                                                                                new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.Auto
            });

            if (learningActivity == null)
            {
                using (var alert = new global::Android.Support.V7.App.AlertDialog.Builder(this))
                {
                    alert.SetTitle(Resource.String.ErrorTitle)
                    .SetMessage(Resource.String.ErrorTitle)
                    .SetOnDismissListener(new OnDismissListener(Finish));
                    alert.Show();
                }
                return;
            }

            dbManager = await Storage.GetDatabaseManager();

            // Load this activity's progress from the database if available
            ActivityProgress progress = dbManager.GetProgress(learningActivity);
            List <AppTask>   appTasks = null;

            try
            {
                if (progress != null)
                {
                    enteredName = progress.EnteredUsername;
                    appTasks    = JsonConvert.DeserializeObject <List <AppTask> >(progress.AppTaskJson);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Toast.MakeText(this, Resource.String.errorCache, ToastLength.Long).Show();
                appTasks = null;
            }

            if (appTasks == null)
            {
                appTasks = learningActivity.LearningTasks.Select(t => new AppTask(t)).ToList();
            }

            bool curatorControls = learningActivity.IsPublic && !learningActivity.Approved && dbManager.CurrentUser.Trusted;

            adapter              = new TaskAdapter(this, learningActivity.Id, appTasks, learningActivity.Description, curatorControls, learningActivity.RequireUsername);
            adapter.ItemClick   += OnItemClick;
            adapter.TextEntered += Adapter_TextEntered;
            adapter.ShowMedia   += ShowMedia;
            adapter.Approved    += Adapter_Approved;
            adapter.SpeakText   += Adapter_SpeakText;
            adapter.ChangeName  += Adapter_EditName;

            SetContentView(Resource.Layout.RecyclerViewActivity);
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            toolbar      = FindViewById <global::Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            LoadHeaderImage(learningActivity.ImageUrl);

            SetupContent();

            if (!string.IsNullOrWhiteSpace(enteredName))
            {
                adapter.UpdateNames(enteredName);
            }
        }
예제 #29
0
        public async void DeleteTask_Success_Test()
        {
            //Arrange
            var repositoryMock = new Mock<IRepository<StoredTaskRequest>>();
            const int toDeleteId = 0;
            repositoryMock.Setup(r => r.DeleteIfExists(toDeleteId)).Returns(Task.FromResult(true));
            var adapter = new TaskAdapter(repositoryMock.Object);

            //Act
            var result = await adapter.DeleteIfExists(toDeleteId);

            //Assert
            Assert.IsTrue(result);
        }
예제 #30
0
        [ExpectedException(typeof(NullReferenceException))] // Assert 
        public async void DeleteTask_Fail_TaskDoesNotExist_Test()
        {
            //Arrange
            var repositoryMock = new Mock<IRepository<StoredTaskRequest>>();
            const int toDeleteId = 0;
            repositoryMock.Setup(r => r.DeleteIfExists(toDeleteId)).Returns(Task.FromResult(false));
            var adapter = new TaskAdapter(repositoryMock.Object);

            //Act
            await adapter.DeleteIfExists(toDeleteId);
        }
예제 #31
0
        public void GetAllTasks_Valid_ReturnsCorrectNumberOfTasks_Test()
        {
            //Arrange
            var task1 = new StoredTaskRequest { }; 
            var task2 = new StoredTaskRequest { };
            var task3 = new StoredTaskRequest { };
            var taskList = new List<StoredTaskRequest> { task1, task2, task3 }.AsQueryable();

            _repositoryMock.Setup(r => r.Read()).Returns(taskList);
            var adapter = new TaskAdapter(_repositoryMock.Object);
            const int expectedCount = 3;

            //Act
            var result = adapter.Read();
            var actualCount = result.ToList().Count;

            //Assert
            Assert.IsTrue(expectedCount == actualCount);
        }
예제 #32
0
        public void GetAllTasks_Valid_ReturnsCorrectTasks_Test()
        {
            // TODO add property values 
            //Arrange
            var task1 = new StoredTaskRequest { Id = 0};
            var task2 = new StoredTaskRequest { Id = 1};
            var task3 = new StoredTaskRequest { Id = 2};
            var taskList = new List<StoredTaskRequest> { task1, task2, task3 }.AsQueryable();

            _repositoryMock.Setup(r => r.Read()).Returns(taskList);
            var adapter = new TaskAdapter(_repositoryMock.Object);

            //Act
            var result = adapter.Read();
            var actualTasks = result.ToList();

            //Assert
            var counter = 0;
            foreach (var actualTask in taskList.AsEnumerable())
            {
                var returnedTask = actualTasks[counter];
                // Todo add property asserts 
                Assert.IsTrue(returnedTask.Id == actualTask.Id);
                counter++;
            }

        }
예제 #33
0
        public async void GetTask_Invalid_NoExistingTask_Test()
        {
            //Arrange
            const int idToRead = 0;
            _repositoryMock.Setup(r => r.Read(idToRead));
            var adapter = new TaskAdapter(_repositoryMock.Object);

            //Act
            var returnedTask = await adapter.Read(idToRead);

            //Assert
            Assert.IsNull(returnedTask);
        }
        public async Task <IHttpActionResult> PostOrderItemDetail(ChangeOrderItemModel coim)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var order = db.Orders.Where(o => o.Id == coim.OrderId).FirstOrDefault();

            if (order == null)
            {
                return(NotFound());
            }
            if (order.OrderStatus == OrderStatus.Partion)
            {
                return(BadRequest());
            }
            try
            {
                OrderItem oi = new OrderItem();
                oi.Id              = Guid.NewGuid();
                oi.ProductId       = coim.OrderItem.ProductId;
                oi.ProductType     = coim.OrderItem.ProductType;
                oi.CertificateDate = coim.OrderItem.CertificateDate;
                oi.CertificateNum  = coim.OrderItem.CertificateNum;
                oi.CustomerPrice   = 0;
                oi.Describe        = coim.OrderItem.Describe;
                oi.EndDate         = coim.OrderItem.EndDate;
                oi.StartDate       = coim.OrderItem.StartDate;
                oi.TotalPrice      = coim.OrderItem.TotalPrice;
                oi.OrderId         = coim.OrderId;
                oi.Remark          = coim.OrderItem.Remark;
                oi.Quantity        = coim.OrderItem.Quantity;
                oi.Persons         = new List <PersonInfo>();
                foreach (var item in coim.OrderItem.Persons)
                {
                    PersonInfo pi = item;
                    oi.Persons.Add(pi);
                }

                order.OrderItems.Add(oi);
                order.OrderItems.First(o => o.Id == coim.OrderItem.Id).State = 1;
                order.OrderStatus = OrderStatus.Partion;
                order.Remark     += "修改订单信息,重新下单";
                db.SaveChanges();


                string      err   = string.Empty;
                TaskAdapter ta    = new TaskAdapter();
                var         tasks = ta.OrderItem2Task(oi, order.OrderCode, db, ref err);
                if (string.IsNullOrEmpty(err))
                {
                    ta.SendTask2Group(tasks, _changeState.Group);
                    OrderUpdateModel oum = new OrderUpdateModel();
                    oum.Id     = order.Id;
                    oum.State  = order.OrderStatus;
                    oum.Remark = order.Remark;
                    _changeState.SendUpdateOrderState(oum);
                }
                else
                {
                    throw new Exception(err);
                }
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
            return(Ok());
        }
예제 #35
0
        private async Task AddData(Controller ctrl, string projectId)
        {
            try
            {
                var output = await ctrl.GetTasks(AccountStorage.DataSet, projectId);

                System.Diagnostics.Debug.WriteLine(output.Count);

                var listAdapter = new TaskAdapter(Activity, Android.Resource.Layout.SimpleListItem1, output.ToArray());
                ListView.Adapter = listAdapter;
                SetListShown(true);
                if (listAdapter.Count == 0)
                {
                    empty.Visibility = ViewStates.Visible;
                }
                else
                {
                    ListView.SetSelection(listAdapter.Count - 1);
                }

                //ListView.SmoothScrollByOffset(listAdapter.Count -1);
                // ListView.SmoothScrollToPosition(listAdapter.Count - 1);
            }
            catch (CannotReachServerException)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("Unable to Connect")
                .SetMessage("Please check your network connection and try again")
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                    ((MainActivity)Activity).FragmentManager.PopBackStack();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (WebException we)
            {
                if (we.Status == WebExceptionStatus.ProtocolError)
                {
                    var response = we.Response as HttpWebResponse;
                    if (response != null)
                    {
                        Console.WriteLine("HTTP Status Code: " + (int)response.StatusCode);
                        if (response.StatusCode == HttpStatusCode.Forbidden)
                        {
                            try
                            {
                                Toast.MakeText(this.Activity, "Username and password error.", ToastLength.Long).Show();
                                System.Diagnostics.Debug.WriteLine("We are about to logout");
                                AccountStorage.ClearStorage();
                                System.Diagnostics.Debug.WriteLine("Main Activity is :" + Activity == null);
                                System.Diagnostics.Debug.WriteLine("Items in the backstack :" + Activity.FragmentManager.BackStackEntryCount);
                                System.Diagnostics.Debug.WriteLine("Main Activity is :" + Activity == null);
                                Activity.FragmentManager.PopBackStack(null, PopBackStackFlags.Inclusive);
                                System.Diagnostics.Debug.WriteLine("Items in the backstack 2 :" + Activity.FragmentManager.BackStackEntryCount);
                                ((MainActivity)(Activity)).SetDrawerState(false);
                                ((MainActivity)(Activity)).SwitchToFragment(MainActivity.FragmentTypes.Login);
                            }
                            catch (System.Exception e)
                            {
                                System.Diagnostics.Debug.WriteLine("We encountered an error :" + e.Message);
                            }
                        }
                    }
                    else
                    {
                        // no http status code available
                        Toast.MakeText(Activity, "Unable to load the data. Please restart the application.", ToastLength.Short).Show();
                    }
                }
                else
                {
                    // no http status code availableToast.MakeText(Activity, "Unable to load the data. Please restart the application.", ToastLength.Short).Show();
                }
            }
            catch (StatusNotOkayException se)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetMessage("Error :" + se.GetMessage())
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (Exception e)
            {
                // For any other weird exceptions
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetNeutralButton("Okay", (sender, args) =>
                {
                    builder.Dispose();
                })
                .SetMessage("Error :" + e.Message)
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
        }
예제 #36
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.InfoPlane);
            context = Application.Context;

            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.AddDrawerListener(drawerToogle);
            drawerToogle.SyncState();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            var id = "ca-app-pub-8211072909515345~1945501010";

            Android.Gms.Ads.MobileAds.Initialize(context, id);
            var adView    = FindViewById <AdView>(Resource.Id.adViewInfoPlane);
            var adRequest = new AdRequest.Builder().Build();

            adView.LoadAd(adRequest);
            //var requestbuilder = new AdRequest.Builder().AddTestDevice("D0BE22F1A4BE27C7470F95A699568FE2");
            //adView.LoadAd(requestbuilder.Build());
            //шрифт
            var font = Typeface.CreateFromAsset(Assets, "dinfont.ttf");

            _InfoSpinnerNation = FindViewById <Spinner>(Resource.Id.InfoSpinnerNation);
            _InfoSpinnerPlane  = FindViewById <Spinner>(Resource.Id.InfoSpinnerPlane);
            _InfoSpinnerRank   = FindViewById <Spinner>(Resource.Id.InfoSpinnerRank);
            _InfoListView      = FindViewById <ListView>(Resource.Id.listView);
            _InfoSpinnerPotentialEnemyPlane = FindViewById <Spinner>(Resource.Id.InfoSpinnerPotentialEnemyPlane);
            //Привязка спиннеров к шарп коду

            #region Привязка TextView к коду
            _InfoImage               = FindViewById <ImageView>(Resource.Id.InfoImage);
            _InfoFlag                = FindViewById <ImageView>(Resource.Id.InfoCompareFlag);
            _InfoHandlingRocket      = FindViewById <ImageView>(Resource.Id.InfoHandlingRocket);
            _InfoHandlingCannon      = FindViewById <ImageView>(Resource.Id.InfoHandlingCannon);
            _InfoHandlingBomb        = FindViewById <ImageView>(Resource.Id.InfoHandlingBomb);
            _InfoHandlingTorpedo     = FindViewById <ImageView>(Resource.Id.InfoHandlingTorpedo);
            _InfoHandlingAirToAir    = FindViewById <ImageView>(Resource.Id.InfoHandlingAirToAir);
            _InfoHandlingAirToGround = FindViewById <ImageView>(Resource.Id.InfoHandlingAirToGround);


            _InfoPlaneTextFirstFlyYear          = FindViewById <TextView>(Resource.Id.InfoPlaneTextFirstFlyYear);
            _InfoPlaneTextPatchAdded            = FindViewById <TextView>(Resource.Id.InfoPlaneTextPatchAdded);
            _InfoPlaneTextBombLoad              = FindViewById <TextView>(Resource.Id.InfoPlaneTextBombLoad);
            _InfoPlaneTextBR                    = FindViewById <TextView>(Resource.Id.InfoPlaneTextBR);
            _InfoPlaneTextType                  = FindViewById <TextView>(Resource.Id.InfoPlaneTextType);
            _InfoPlaneTextMaxSpeedAt0           = FindViewById <TextView>(Resource.Id.InfoPlaneTextMaxSpeedAt0);
            _InfoPlaneTextMaxSpeedAt5000        = FindViewById <TextView>(Resource.Id.InfoPlaneTextMaxSpeedAt5000);
            _InfoPlaneTextTurnAt0               = FindViewById <TextView>(Resource.Id.InfoPlaneTextTurnAt0);
            _InfoPlaneTextClimb                 = FindViewById <TextView>(Resource.Id.InfoPlaneTextClimb);
            _InfoPlaneTextEnginePower           = FindViewById <TextView>(Resource.Id.InfoPlaneTextEnginePower);
            _InfoPlaneTextWeight                = FindViewById <TextView>(Resource.Id.InfoPlaneTextWeight);
            _InfoPlaneTextThrustToWeightRatio   = FindViewById <TextView>(Resource.Id.InfoPlaneTextThrustToWeightRatio);
            _InfoPlaneTextWeaponVolleyPerSecond = FindViewById <TextView>(Resource.Id.InfoPlaneTextWeaponVolleyPerSecond);
            _InfoPlaneTextWeaponAndTurrels      = FindViewById <TextView>(Resource.Id.InfoPlaneTextWeaponAndTurrels);
            _InfoPlaneTextPlaneCharacter        = FindViewById <TextView>(Resource.Id.InfoPlaneTextPlaneCharacter);
            _InfoPlaneTextFlutter               = FindViewById <TextView>(Resource.Id.InfoPlaneTextFlutter);

            _InfoPlaneLabelTextHandingWeapon         = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextHandingWeapon);
            _InfoPlaneLabelTextFirstFlyYear          = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextFirstFlyYear);
            _InfoPlaneLabelTextPatchAdded            = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextPlanePatchAdded);
            _InfoPlaneLabelTextBombLoad              = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextBombLoad);
            _InfoPlaneLabelTextBR                    = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextBR);
            _InfoPlaneLabelTextType                  = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextType);
            _InfoPlaneLabelTextMaxSpeedAt0           = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextMaxSpeedAt0);
            _InfoPlaneLabelTextMaxSpeedAt5000        = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextMaxSpeedAt5000);
            _InfoPlaneLabelTextTurnAt0               = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextTurnAt0);
            _InfoPlaneLabelTextClimb                 = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextClimb);
            _InfoPlaneLabelTextEnginePower           = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextEnginePower);
            _InfoPlaneLabelTextWeight                = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextWeight);
            _InfoPlaneLabelTextThrustToWeightRatio   = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextThrustToWeightRatio);
            _InfoPlaneLabelTextWeaponVolleyPerSecond = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextWeaponVolleyPerSecond);
            _InfoPlaneLabelTextPlaneCharacter        = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextPlaneCharacter);
            _InfoPlaneLabelTextFlutter               = FindViewById <TextView>(Resource.Id.InfoPlaneLabelTextFlutter);

            #endregion

            #region Изменения шрифта

            _InfoPlaneLabelTextPatchAdded.Typeface            = font;
            _InfoPlaneLabelTextFirstFlyYear.Typeface          = font;
            _InfoPlaneLabelTextBombLoad.Typeface              = font;
            _InfoPlaneLabelTextHandingWeapon.Typeface         = font;
            _InfoPlaneLabelTextBR.Typeface                    = font;
            _InfoPlaneLabelTextType.Typeface                  = font;
            _InfoPlaneLabelTextMaxSpeedAt0.Typeface           = font;
            _InfoPlaneLabelTextMaxSpeedAt5000.Typeface        = font;
            _InfoPlaneLabelTextTurnAt0.Typeface               = font;
            _InfoPlaneLabelTextClimb.Typeface                 = font;
            _InfoPlaneLabelTextEnginePower.Typeface           = font;
            _InfoPlaneLabelTextWeight.Typeface                = font;
            _InfoPlaneLabelTextThrustToWeightRatio.Typeface   = font;
            _InfoPlaneLabelTextWeaponVolleyPerSecond.Typeface = font;
            _InfoPlaneLabelTextPlaneCharacter.Typeface        = font;
            _InfoPlaneTextWeaponAndTurrels.Typeface           = font;
            _InfoPlaneLabelTextFlutter.Typeface               = font;
            #endregion

            #region Изменения цвета текста всех TextView


            _InfoPlaneTextPatchAdded.SetTextColor(Color.Black);
            _InfoPlaneTextFirstFlyYear.SetTextColor(Color.Black);
            _InfoPlaneTextBombLoad.SetTextColor(Color.Black);
            _InfoPlaneTextBR.SetTextColor(Color.Black);
            _InfoPlaneTextType.SetTextColor(Color.Black);
            _InfoPlaneTextMaxSpeedAt0.SetTextColor(Color.Black);
            _InfoPlaneTextMaxSpeedAt5000.SetTextColor(Color.Black);
            _InfoPlaneTextTurnAt0.SetTextColor(Color.Black);
            _InfoPlaneTextClimb.SetTextColor(Color.Black);
            _InfoPlaneTextEnginePower.SetTextColor(Color.Black);
            _InfoPlaneTextWeight.SetTextColor(Color.Black);
            _InfoPlaneTextThrustToWeightRatio.SetTextColor(Color.Black);
            _InfoPlaneTextWeaponVolleyPerSecond.SetTextColor(Color.Black);
            _InfoPlaneTextFlutter.SetTextColor(Color.Black);



            _InfoPlaneTextWeaponAndTurrels.SetTextColor(Color.Black);
            _InfoPlaneTextPlaneCharacter.SetTextColor(Color.Black);

            _InfoPlaneLabelTextPatchAdded.SetTextColor(Color.Black);
            _InfoPlaneLabelTextFirstFlyYear.SetTextColor(Color.Black);
            _InfoPlaneLabelTextBombLoad.SetTextColor(Color.Black);
            _InfoPlaneLabelTextHandingWeapon.SetTextColor(Color.Black);
            _InfoPlaneLabelTextBR.SetTextColor(Color.Black);
            _InfoPlaneLabelTextType.SetTextColor(Color.Black);
            _InfoPlaneLabelTextMaxSpeedAt0.SetTextColor(Color.Black);
            _InfoPlaneLabelTextMaxSpeedAt5000.SetTextColor(Color.Black);
            _InfoPlaneLabelTextTurnAt0.SetTextColor(Color.Black);
            _InfoPlaneLabelTextClimb.SetTextColor(Color.Black);
            _InfoPlaneLabelTextEnginePower.SetTextColor(Color.Black);
            _InfoPlaneLabelTextWeight.SetTextColor(Color.Black);
            _InfoPlaneLabelTextThrustToWeightRatio.SetTextColor(Color.Black);
            _InfoPlaneLabelTextWeaponVolleyPerSecond.SetTextColor(Color.Black);
            _InfoPlaneLabelTextPlaneCharacter.SetTextColor(Color.Black);
            _InfoPlaneLabelTextFlutter.SetTextColor(Color.Black);

            #endregion

            nations       = NationCollection.GetNation();
            AdapterNation = new NationAdapter(this, nations);
            _InfoSpinnerNation.Adapter = AdapterNation;
            _InfoSpinnerNation.SetSelection(1); //Автовыбор
            selectedNation = 1;                 //Автовыбор

            ranks       = RankCollection.GetRank();
            AdapterRank = new RankAdapter(this, ranks);
            _InfoSpinnerRank.Adapter = AdapterRank;
            _InfoSpinnerRank.SetSelection(6); //Автовыбор
            selectedRank = 6;                 //Автовыбор

            potentialTaskPlane        = TaskCollection.GetTask();
            PotentialAdapterTaskPlane = new TaskAdapter(this, potentialTaskPlane);
            _InfoSpinnerPotentialEnemyPlane.Adapter = PotentialAdapterTaskPlane;
            _InfoSpinnerPotentialEnemyPlane.SetSelection(0); //Автовыбор
            SelectedPotentialTaskPlane = 0;                  //Автовыбор

            _InfoSpinnerPlane.SetSelection(7);
            //Объявление коллекции наций, рангов и адаптеров

            _InfoSpinnerNation.ItemSelected += _InfoSpinnerNation_ItemSelected;
            _InfoSpinnerRank.ItemSelected   += _InfoSpinnerRank_ItemSelected;
            _InfoSpinnerPlane.ItemSelected  += _InfoSpinnerPlane_ItemSelected;
            _InfoSpinnerPotentialEnemyPlane.ItemSelected += _InfoSpinnerPotentialEnemyPlane_ItemSelected;
            //События спиннеров
        }
예제 #37
0
        ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\



        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.InfoShip);
            context = Application.Context;
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.app_name);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.AddDrawerListener(drawerToogle);
            drawerToogle.SyncState();
            ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\ 
            var id = "ca-app-pub-8211072909515345~1945501010";

            Android.Gms.Ads.MobileAds.Initialize(context, id);
            var adView    = FindViewById <AdView>(Resource.Id.adViewInfoShip);
            var adRequest = new AdRequest.Builder().Build();

            adView.LoadAd(adRequest);
            //var requestbuilder = new AdRequest.Builder().AddTestDevice("D0BE22F1A4BE27C7470F95A699568FE2");
            //adView.LoadAd(requestbuilder.Build());
            //шрифт
            var font = Typeface.CreateFromAsset(Assets, "dinfont.ttf");

            _InfoSpinnerNation             = FindViewById <Spinner>(Resource.Id.InfoSpinnerNationS);
            _InfoSpinnerRank               = FindViewById <Spinner>(Resource.Id.InfoSpinnerRankS);
            _InfoSpinnerShip               = FindViewById <Spinner>(Resource.Id.InfoSpinnerShip);
            _InfoListView                  = FindViewById <ListView>(Resource.Id.listViewS);
            _InfoSpinnerPotentialEnemyShip = FindViewById <Spinner>(Resource.Id.InfoSpinnerPotentialEnemyShip);
            //Привязка спиннеров к шарп коду

            #region Привязка TextView к коду
            _InfoImage = FindViewById <ImageView>(Resource.Id.InfoImageS);
            _InfoFlag  = FindViewById <ImageView>(Resource.Id.InfoFlagS);

            _InfoHandingRocket       = FindViewById <ImageView>(Resource.Id.InfoShipHandingRocket);
            _InfoHandlingDepthCharge = FindViewById <ImageView>(Resource.Id.InfoShipHandingDepthCharge);
            _InfoHandlingTorpedo     = FindViewById <ImageView>(Resource.Id.InfoShipHandingTorpedo);
            _InfoHandingMine         = FindViewById <ImageView>(Resource.Id.InfoShipHandingMine);

            _InfoMCShellAP       = FindViewById <ImageView>(Resource.Id.InfoShipMCShellAP);
            _InfoMCShellAPHE     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellAPHE);
            _InfoMCShellAPCR     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellAPCR);
            _InfoMCShellHE       = FindViewById <ImageView>(Resource.Id.InfoShipMCShellHE);
            _InfoMCShellHEVT     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellHEVT);
            _InfoMCShellHEDF     = FindViewById <ImageView>(Resource.Id.InfoShipMCShellHEDF);
            _InfoMCShellFOG      = FindViewById <ImageView>(Resource.Id.InfoShipMCShellFOG);
            _InfoMCShellShrapnel = FindViewById <ImageView>(Resource.Id.InfoShipMCShellShrapnel);
            _InfoAUShellShrapnel = FindViewById <ImageView>(Resource.Id.InfoShipAUShellShrapnel);
            _InfoAUShellAP       = FindViewById <ImageView>(Resource.Id.InfoShipAUShellAP);
            _InfoAUShellAPHE     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellAPHE);
            _InfoAUShellAPCR     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellAPCR);
            _InfoAUShellHE       = FindViewById <ImageView>(Resource.Id.InfoShipAUShellHE);
            _InfoAUShellHEVT     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellHEVT);
            _InfoAUShellHEDF     = FindViewById <ImageView>(Resource.Id.InfoShipAUShellHEDF);
            _InfoAUShellFOG      = FindViewById <ImageView>(Resource.Id.InfoShipAUShellFOG);
            _InfoAAAShellAP      = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellAP);
            _InfoAAAShellAPHE    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellAPHE);
            _InfoAAAShellAPCR    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellAPCR);
            _InfoAAAShellHE      = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellHE);
            _InfoAAAShellHEVT    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellHEVT);
            _InfoAAAShellHEDF    = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellHEDF);
            _InfoAAAShellFOG     = FindViewById <ImageView>(Resource.Id.InfoShipAAAShellFOG);

            _InfoShipLabelTextFirstLaunch = FindViewById <TextView>(Resource.Id.InfoShipLabelTextShipLaunched);
            _InfoShipLabelTextPatchAdded  = FindViewById <TextView>(Resource.Id.InfoShipLabelTextPatchAdded);
            _InfoShipLabelTextType        = FindViewById <TextView>(Resource.Id.InfoShipLabelTextType);
            _InfoShipLabelTextCharacter   = FindViewById <TextView>(Resource.Id.InfoShipLabelTextCharacter);
            _InfoShipLabelTextBR          = FindViewById <TextView>(Resource.Id.InfoShipLabelTextBR);

            _InfoShipTextFirstLaunch = FindViewById <TextView>(Resource.Id.InfoShipTextShipLaunched);
            _InfoShipTextPatchAdded  = FindViewById <TextView>(Resource.Id.InfoShipTextPatchAdded);
            _InfoShipTextType        = FindViewById <TextView>(Resource.Id.InfoShipTextType);
            _InfoShipTextCharacter   = FindViewById <TextView>(Resource.Id.InfoShipTextCharacter);
            _InfoShipTextBR          = FindViewById <TextView>(Resource.Id.InfoShipTextBR);


            _InfoShipTextMainCaliberName        = FindViewById <TextView>(Resource.Id.InfoShipTextMainCaliber);
            _InfoShipTextMainCaliberReload      = FindViewById <TextView>(Resource.Id.InfoShipTextMainCaliberReload);
            _InfoShipTextMainCaliberTNT         = FindViewById <TextView>(Resource.Id.InfoShipTextMainCaliberTNT);
            _InfoShipTextAuxiliaryCaliberName   = FindViewById <TextView>(Resource.Id.InfoShipTextAuxiliaryCaliber);
            _InfoShipTextAuxiliaryCaliberReload = FindViewById <TextView>(Resource.Id.InfoShipTextAuxiliaryCaliberReload);
            _InfoShipTextAAACaliberName         = FindViewById <TextView>(Resource.Id.InfoShipTextAAACaliber);
            _InfoShipTextAAACaliberReload       = FindViewById <TextView>(Resource.Id.InfoShipTextAAACaliberReload);
            _InfoShipTextTorpedoName            = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedo);
            _InfoShipTextTorpedoItem            = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedoItem);
            _InfoShipTextTorpedoMaxSpeed        = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedoMaxSpeed);
            _InfoShipTextTorpedoTNT             = FindViewById <TextView>(Resource.Id.InfoShipTextTorpedoTNT);
            _InfoShipTextMaxSpeed     = FindViewById <TextView>(Resource.Id.InfoShipTextMaxSpeed);
            _InfoShipTextReverseSpeed = FindViewById <TextView>(Resource.Id.InfoShipTextReverseSpeed);
            _InfoShipTextAcceleration = FindViewById <TextView>(Resource.Id.InfoShipTextAcceleration);
            _InfoShipTextBrakingTime  = FindViewById <TextView>(Resource.Id.InfoShipTextBrakingTime);
            _InfoShipTextTurn360      = FindViewById <TextView>(Resource.Id.InfoShipTextTurn360);
            _InfoShipTextDisplacement = FindViewById <TextView>(Resource.Id.InfoShipTextDisplacement);
            _InfoShipTextCrewCount    = FindViewById <TextView>(Resource.Id.InfoShipTextCrewCount);

            _InfoShipLabelTextMainCaliberReload      = FindViewById <TextView>(Resource.Id.InfoShipLabelMainCaliberReload);
            _InfoShipLabelTextMainCaliberTNT         = FindViewById <TextView>(Resource.Id.InfoShipLabelMainCaliberTNT);
            _InfoShipLabelTextAuxiliaryCaliberReload = FindViewById <TextView>(Resource.Id.InfoShipLabelAuxiliaryCaliberReload);
            _InfoShipLabelTextAAACaliberReload       = FindViewById <TextView>(Resource.Id.InfoShipLabelAAACaliberReload);
            _InfoShipLabelTextTorpedoItem            = FindViewById <TextView>(Resource.Id.InfoShipLabelTorpedoItem);
            _InfoShipLabelTextTorpedoMaxSpeed        = FindViewById <TextView>(Resource.Id.InfoShipLabelTorpedoMaxSpeed);
            _InfoShipLabelTextTorpedoTNT             = FindViewById <TextView>(Resource.Id.InfoShipLabelTorpedoTNT);
            _InfoShipLabelTextMaxSpeed     = FindViewById <TextView>(Resource.Id.InfoShipLabelMaxSpeed);
            _InfoShipLabelTextReverseSpeed = FindViewById <TextView>(Resource.Id.InfoShipLabelReverseSpeed);
            _InfoShipLabelTextAcceleration = FindViewById <TextView>(Resource.Id.InfoShipLabelAcceleration);
            _InfoShipLabelTextBrakingTime  = FindViewById <TextView>(Resource.Id.InfoShipLabelBrakingTime);
            _InfoShipLabelTextTurn360      = FindViewById <TextView>(Resource.Id.InfoShipLabelTurn360);
            _InfoShipLabelTextDisplacement = FindViewById <TextView>(Resource.Id.InfoShipLabelDisplacement);
            _InfoShipLabelTextCrewCount    = FindViewById <TextView>(Resource.Id.InfoShipLabelCrewCount);
            _InfoShipLabelTextMCShellType  = FindViewById <TextView>(Resource.Id.InfoShipLabelMCShellType);
            _InfoShipLabelTextAUShellType  = FindViewById <TextView>(Resource.Id.InfoShipLabelAUShellType);
            _InfoShipLabelTextAAAShellType = FindViewById <TextView>(Resource.Id.InfoShipLabelAAAShellType);
            _InfoShipLabelTextAdditional   = FindViewById <TextView>(Resource.Id.InfoShipLabelAdditionalWeapon);
            #endregion

            #region Изменение шрифта и цвета

            _InfoShipLabelTextMainCaliberReload.Typeface      = font;
            _InfoShipLabelTextMainCaliberTNT.Typeface         = font;
            _InfoShipLabelTextAuxiliaryCaliberReload.Typeface = font;
            _InfoShipLabelTextAAACaliberReload.Typeface       = font;
            _InfoShipLabelTextTorpedoItem.Typeface            = font;
            _InfoShipLabelTextTorpedoMaxSpeed.Typeface        = font;
            _InfoShipLabelTextTorpedoTNT.Typeface             = font;
            _InfoShipLabelTextMaxSpeed.Typeface     = font;
            _InfoShipLabelTextReverseSpeed.Typeface = font;
            _InfoShipLabelTextAcceleration.Typeface = font;
            _InfoShipLabelTextBrakingTime.Typeface  = font;
            _InfoShipLabelTextTurn360.Typeface      = font;
            _InfoShipLabelTextDisplacement.Typeface = font;
            _InfoShipLabelTextCrewCount.Typeface    = font;

            _InfoShipLabelTextFirstLaunch.Typeface  = font;
            _InfoShipLabelTextPatchAdded.Typeface   = font;
            _InfoShipLabelTextType.Typeface         = font;
            _InfoShipLabelTextCharacter.Typeface    = font;
            _InfoShipLabelTextBR.Typeface           = font;
            _InfoShipLabelTextMCShellType.Typeface  = font;
            _InfoShipLabelTextAUShellType.Typeface  = font;
            _InfoShipLabelTextAAAShellType.Typeface = font;
            _InfoShipLabelTextAdditional.Typeface   = font;


            _InfoShipLabelTextMainCaliberReload.SetTextColor(Color.Black);
            _InfoShipLabelTextMainCaliberTNT.SetTextColor(Color.Black);
            _InfoShipLabelTextAuxiliaryCaliberReload.SetTextColor(Color.Black);
            _InfoShipLabelTextAAACaliberReload.SetTextColor(Color.Black);
            _InfoShipLabelTextTorpedoItem.SetTextColor(Color.Black);
            _InfoShipLabelTextTorpedoMaxSpeed.SetTextColor(Color.Black);
            _InfoShipLabelTextTorpedoTNT.SetTextColor(Color.Black);
            _InfoShipLabelTextMaxSpeed.SetTextColor(Color.Black);
            _InfoShipLabelTextReverseSpeed.SetTextColor(Color.Black);
            _InfoShipLabelTextAcceleration.SetTextColor(Color.Black);
            _InfoShipLabelTextBrakingTime.SetTextColor(Color.Black);
            _InfoShipLabelTextTurn360.SetTextColor(Color.Black);
            _InfoShipLabelTextDisplacement.SetTextColor(Color.Black);
            _InfoShipLabelTextCrewCount.SetTextColor(Color.Black);


            _InfoShipTextMainCaliberName.SetTextColor(Color.Black);
            _InfoShipTextMainCaliberReload.SetTextColor(Color.Black);
            _InfoShipTextMainCaliberTNT.SetTextColor(Color.Black);
            _InfoShipTextAuxiliaryCaliberName.SetTextColor(Color.Black);
            _InfoShipTextAuxiliaryCaliberReload.SetTextColor(Color.Black);
            _InfoShipTextAAACaliberName.SetTextColor(Color.Black);
            _InfoShipTextAAACaliberReload.SetTextColor(Color.Black);
            _InfoShipTextTorpedoName.SetTextColor(Color.Black);
            _InfoShipTextTorpedoItem.SetTextColor(Color.Black);
            _InfoShipTextTorpedoMaxSpeed.SetTextColor(Color.Black);
            _InfoShipTextTorpedoTNT.SetTextColor(Color.Black);
            _InfoShipTextMaxSpeed.SetTextColor(Color.Black);
            _InfoShipTextReverseSpeed.SetTextColor(Color.Black);
            _InfoShipTextAcceleration.SetTextColor(Color.Black);
            _InfoShipTextBrakingTime.SetTextColor(Color.Black);
            _InfoShipTextTurn360.SetTextColor(Color.Black);
            _InfoShipTextDisplacement.SetTextColor(Color.Black);
            _InfoShipTextCrewCount.SetTextColor(Color.Black);

            _InfoShipLabelTextFirstLaunch.SetTextColor(Color.Black);
            _InfoShipLabelTextPatchAdded.SetTextColor(Color.Black);
            _InfoShipLabelTextType.SetTextColor(Color.Black);
            _InfoShipLabelTextCharacter.SetTextColor(Color.Black);
            _InfoShipLabelTextBR.SetTextColor(Color.Black);


            _InfoShipTextFirstLaunch.SetTextColor(Color.Black);
            _InfoShipTextPatchAdded.SetTextColor(Color.Black);
            _InfoShipTextType.SetTextColor(Color.Black);
            _InfoShipTextCharacter.SetTextColor(Color.Black);
            _InfoShipTextBR.SetTextColor(Color.Black);
            #endregion

            nations       = NationCollection.GetNation();
            AdapterNation = new NationAdapter(this, nations);
            _InfoSpinnerNation.Adapter = AdapterNation;
            _InfoSpinnerNation.SetSelection(1); //Автовыбор
            selectedNation = 1;                 //Автовыбор

            ranks       = RankCollection.GetRank();
            AdapterRank = new RankAdapter(this, ranks);
            _InfoSpinnerRank.Adapter = AdapterRank;
            _InfoSpinnerRank.SetSelection(4); //Автовыбор
            selectedRank = 4;                 //Автовыбор

            potentialTask            = ShipTaskCollection.GetTask();
            PotentialAdapterTaskShip = new TaskAdapter(this, potentialTask);
            _InfoSpinnerPotentialEnemyShip.Adapter = PotentialAdapterTaskShip;
            _InfoSpinnerPotentialEnemyShip.SetSelection(0); //Автовыбор
            SelectedPotentialTaskShip = 0;                  //Автовыбор

            _InfoSpinnerShip.SetSelection(1);
            //Объявление коллекции наций, рангов и адаптеров

            _InfoSpinnerNation.ItemSelected             += _InfoSpinnerNation_ItemSelected;
            _InfoSpinnerRank.ItemSelected               += _InfoSpinnerRank_ItemSelected;
            _InfoSpinnerShip.ItemSelected               += _InfoSpinnerShip_ItemSelected;
            _InfoSpinnerPotentialEnemyShip.ItemSelected += _InfoSpinnerPotentialEnemyShip_ItemSelected;
        }