protected TestsForPanelRotation() { _panelRotation = new PanelRotation() .WithMinimum(new Rotation(1)) .WithMaximum(new Rotation(2)) .WithInitial(new Rotation(3)) .WithStart(new Rotation(4)) .WithEnd(new Rotation(5)); }
public override View GetView(int index, View convertView, ViewGroup parent) { var view = activity.LayoutInflater.Inflate(Resource.Layout.PanelListItem, parent, false); var PanelCount = view.FindViewById <TextView>(Resource.Id.panelCount); PanelCount.Text = panelList[index].Count.ToString(); var ppr = view.FindViewById <TextView>(Resource.Id.ppr); ppr.Text = panelList[index].PowerRating.ToString() + " kW/h"; var tpr = view.FindViewById <TextView>(Resource.Id.tpr); tpr.Text = (panelList[index].PowerRating * panelList[index].Count).ToString() + " kW/h"; var pmt = view.FindViewById <TextView>(Resource.Id.pmt); pmt.Text = activity.Resources.GetStringArray(Resource.Array.module_type_array)[(int)panelList[index].ModuleType]; var cardview = view.FindViewById <CardView>(Resource.Id.itemCardView); var lineView = view.FindViewById <View>(Resource.Id.lineView); var deg = view.FindViewById <TextView>(Resource.Id.deg); PanelRotation pr = GetRotation(panelList[index]); if (pr.IsDay) { lineView.Rotation = (float)Math.Round(pr.Rotation); deg.Text = Math.Round(pr.Rotation).ToString() + "°"; } else { lineView.Rotation = 90f; deg.Text = "(No Sun)"; } cardview.Click += delegate { var nextActivity = new Intent(activity, typeof(PanelInfoActivity)); nextActivity.PutExtra("netID", (long)netID); nextActivity.PutExtra("panelID", (long)panelList[index].ID); activity.StartActivity(nextActivity); }; var del = view.FindViewById <Button>(Resource.Id.delete_button); del.Click += delegate { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(activity); string msg; if (panelList[index].Count == 1) { msg = "panel"; } else { msg = "panels"; } alertDialog.SetTitle("Delete " + msg); alertDialog.SetMessage(String.Format("Are you sure you want to delete this {0}?", msg)); alertDialog.SetNeutralButton("Yes", async delegate { await DeletePanel(panelList[index]); alertDialog.Dispose(); }); alertDialog.SetNegativeButton("No", delegate { alertDialog.Dispose(); }); alertDialog.Show(); }; return(view); }
public WithRotation() { _value = new PanelRotation().WithStart(new Rotation(47)); }