public void Draw(TextView textView, DrawingContext drawingContext) { if (textView == null) throw new ArgumentNullException("textView"); if (drawingContext == null) throw new ArgumentNullException("drawingContext"); if (currentResults == null || !textView.VisualLinesValid) return; var visualLines = textView.VisualLines; if (visualLines.Count == 0) return; int viewStart = visualLines.First().FirstDocumentLine.Offset; int viewEnd = visualLines.Last().LastDocumentLine.EndOffset; foreach (SearchResult result in currentResults.FindOverlappingSegments(viewStart, viewEnd - viewStart)) { BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder(); geoBuilder.AlignToMiddleOfPixels = true; geoBuilder.CornerRadius = 3; geoBuilder.AddSegment(textView, result); Geometry geometry = geoBuilder.CreateGeometry(); if (geometry != null) { drawingContext.DrawGeometry(markerBrush, markerPen, geometry); } } }
public override bool View(TextView.DecompilerTextView textView) { EmbeddedResource er = r as EmbeddedResource; if (er != null) return View(this, textView, new MemoryStream(er.GetResourceData()), er.Name); return false; }
//Constructor public CustomControl1() { //Init Default properties InitializeComponent(); //Init vScrollBar1 this.vScrollBar1 = new VScrollBar(); this.vScrollBar1.Minimum = 0; this.vScrollBar1.Maximum = 100; this.vScrollBar1.Location = new Point(this.ClientRectangle.Right - this.vScrollBar1.Width, this.ClientRectangle.Top); //this.vScrollBar1.Location = new Point(this.ClientRectangle.Right - this.vScrollBar1.Width, 0); //this.vScrollBar1.Location = new Point(0, this.ClientRectangle.Top); //this.vScrollBar1.Location = new Point(0, 0); //this.vScrollBar1.Height = this.ClientRectangle.Height; this.Controls.Add(vScrollBar1); this.vScrollBar1.ValueChanged += new EventHandler(vScrollBar1_ValueChanged); //Init Text property //this.Text = "Hello World!"; //Init textview property tv= new TextView(); //Init clientRectResize clientRectResized = true; }
public ColumnRulerRenderer(TextView textView) { if (textView == null) throw new ArgumentNullException("textView"); this.pen = new Pen(new SolidColorBrush(DefaultForeground), 1); this.pen.Freeze(); this.textView = textView; ColumnRulerRenderer oldRenderer = null; // Make sure there is only one of this type of background renderer // Otherwise, we might keep adding and WPF keeps drawing them on top of each other foreach (var item in this.textView.BackgroundRenderers) { if (item != null) { if (item is ColumnRulerRenderer) oldRenderer = item as ColumnRulerRenderer; } } this.textView.BackgroundRenderers.Remove(oldRenderer); this.textView.BackgroundRenderers.Add(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.SetContentView(Resource.Layout.Main); var playButton = this.FindViewById<Button>(Resource.Id.PlayPauseButton); var stopButton = this.FindViewById<Button>(Resource.Id.StopButton); var searchView = this.FindViewById<SearchView>(Resource.Id.SearchView); this.listView = this.FindViewById<ListView>(Resource.Id.listView1); this.timeDisplay = this.FindViewById<TextView>(Resource.Id.TimeDisplay); this.adapter = new SongResultsAdapter(this, new Song[0]); this.player = new MediaPlayer(); this.switcher = this.FindViewById<ViewSwitcher>(Resource.Id.ViewSwitcher); this.loadingMessage = this.FindViewById<TextView>(Resource.Id.LoadingMessage); playButton.Click += this.PlayButton_Click; stopButton.Click += this.StopButton_Click; searchView.QueryTextSubmit += this.SearchView_QueryTextSubmit; searchView.QueryTextChange += this.SearchView_QueryTextChange; this.listView.ItemClick += this.ListView_ItemClick; this.player.BufferingUpdate += this.Player_BufferingUpdate; this.player.Error += this.Player_Error; this.ShowListViewMessage("Write in the search box to start."); }
public override void Attach(ITextEditor editor) { base.Attach(editor); // try to access the ICSharpCode.AvalonEdit.Rendering.TextView // of this ITextEditor this.textView = editor.GetService(typeof(TextView)) as TextView; // if editor is not an AvalonEdit.TextEditor // GetService returns null if (textView != null) { if (SD.Workbench != null) { // if (XamlBindingOptions.UseAdvancedHighlighting) { // colorizer = new XamlColorizer(editor, textView); // // attach the colorizer // textView.LineTransformers.Add(colorizer); // } // add the XamlOutlineContentHost, which manages the tree view contentHost = new XamlOutlineContentHost(editor); textView.Services.AddService(typeof(IOutlineContentHost), contentHost); } // add ILanguageBinding textView.Services.AddService(typeof(XamlTextEditorExtension), this); } SD.ParserService.ParseInformationUpdated += ParseInformationUpdated; }
void ITextViewConnect.RemoveFromTextView(TextView textView) { if (wasAutoAddedToTextView && this.TextView == textView) { this.TextView = null; Debug.Assert(!wasAutoAddedToTextView); // setting this.TextView should have unset this flag } }
public ChessGameView() : base() { handCursor = new Gdk.Cursor (Gdk.CursorType.Hand2); regularCursor = new Gdk.Cursor (Gdk.CursorType.Xterm); marks = new Hashtable (); tag_links = new Hashtable (); taglinks = new ArrayList (); curMoveIdx = -1; view = new TextView (); view.WrapMode = WrapMode.Word; view.Editable = false; view.WidgetEventAfter += EventAfter; view.MotionNotifyEvent += MotionNotify; view.VisibilityNotifyEvent += VisibilityNotify; ScrolledWindow win = new ScrolledWindow (); win.SetPolicy (PolicyType.Never, PolicyType.Automatic); win.Add (view); PackStart (win, true, true, 0); view.WidthRequest = 150; CreateTags (); ShowAll (); }
public static int Main9 (string[] args) { Gtk.Application.Init (); Window win = new Window ("Custom Widget Test"); win.DeleteEvent += new DeleteEventHandler (OnQuit); VPaned paned = new VPaned (); CustomWidget cw = new CustomWidget (); cw.Label = "This one contains a button"; Button button = new Button ("Ordinary button"); cw.Add (button); paned.Pack1 (cw, true, false); cw = new CustomWidget (); cw.Label = "And this one a TextView"; cw.StockId = Stock.JustifyLeft; ScrolledWindow sw = new ScrolledWindow (null, null); sw.ShadowType = ShadowType.In; sw.HscrollbarPolicy = PolicyType.Automatic; sw.VscrollbarPolicy = PolicyType.Automatic; TextView textView = new TextView (); sw.Add (textView); cw.Add (sw); paned.Pack2 (cw, true, false); win.Add (paned); win.ShowAll (); Gtk.Application.Run (); return 0; }
/// <inheritdoc/> protected override void OnAddToTextView(TextView textView) { base.OnAddToTextView(textView); textView.DocumentChanged += textView_DocumentChanged; textView.VisualLineConstructionStarting += textView_VisualLineConstructionStarting; OnDocumentChanged(textView); }
public static void Main() { BusG.Init (); Application.Init (); tv = new TextView (); ScrolledWindow sw = new ScrolledWindow (); sw.Add (tv); Button btn = new Button ("Click me"); btn.Clicked += OnClick; Button btnq = new Button ("Click me (thread)"); btnq.Clicked += OnClickQuit; VBox vb = new VBox (false, 2); vb.PackStart (sw, true, true, 0); vb.PackStart (btn, false, true, 0); vb.PackStart (btnq, false, true, 0); Window win = new Window ("D-Bus#"); win.SetDefaultSize (640, 480); win.Add (vb); win.Destroyed += delegate {Application.Quit ();}; win.ShowAll (); bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus")); Application.Run (); }
/// <summary> /// Creates a new TextArea instance. /// </summary> protected TextArea(TextView textView) { if (textView == null) throw new ArgumentNullException("textView"); this.textView = textView; this.Options = textView.Options; selection = emptySelection = new EmptySelection(this); textView.Services.AddService(typeof(TextArea), this); textView.LineTransformers.Add(new SelectionColorizer(this)); textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace); caret = new Caret(this); caret.PositionChanged += (sender, e) => RequestSelectionValidation(); caret.PositionChanged += CaretPositionChanged; AttachTypingEvents(); ime = new ImeSupport(this); leftMargins.CollectionChanged += leftMargins_CollectionChanged; this.DefaultInputHandler = new TextAreaDefaultInputHandler(this); this.ActiveInputHandler = this.DefaultInputHandler; }
public void Draw(TextView textView, DrawingContext drawingContext) { foreach (TextSegment current in this.SearchHitsSegments) { foreach (Rect current2 in BackgroundGeometryBuilder.GetRectsForSegment(textView, current)) { Point bottomLeft = current2.BottomLeft; Point bottomRight = current2.BottomRight; Pen pen = new Pen(new SolidColorBrush(Colors.OrangeRed), 1); pen.Freeze(); double num = 2.5; int count = System.Math.Max((int)((bottomRight.X - bottomLeft.X) / num) + 1, 4); StreamGeometry streamGeometry = new StreamGeometry(); using (StreamGeometryContext streamGeometryContext = streamGeometry.Open()) { streamGeometryContext.BeginFigure(bottomLeft, true, true); streamGeometryContext.LineTo(current2.TopLeft, true, false); streamGeometryContext.LineTo(current2.TopRight, true, false); streamGeometryContext.LineTo(current2.BottomRight, true, false); } streamGeometry.Freeze(); drawingContext.DrawGeometry(Brushes.Transparent, pen, streamGeometry); } } }
void ITextEditorExtension.Attach(ITextEditor editor) { _outlineContent = new ModuleOutlineControl(editor); _textView = editor.GetService(typeof(TextView)) as TextView; _textView.Services.AddService(typeof(IOutlineContentHost), _outlineContent); }
public static void Main(string[] args) { Application.Init(); //Create the Window Window myWin = new Window("GtkSpell# Sample App"); myWin.Resize(200,200); //Create a TextView TextView myTextView = new TextView(); SpellCheck mySpellCheck; //Bind GtkSpell to our textview if (args.Length > 0) mySpellCheck = new SpellCheck(myTextView, args[0]); else mySpellCheck = new SpellCheck(myTextView, "en-us"); //spellCheck.Detach(); //spellCheck.(); //Add the TextView to the form myWin.Add(myTextView); //Show Everything myWin.ShowAll(); myWin.DeleteEvent += new DeleteEventHandler(delete); Application.Run(); }
public Layer(TextView textView, KnownLayer knownLayer) { Debug.Assert(textView != null); this.textView = textView; this.knownLayer = knownLayer; Focusable = false; }
/// <summary> /// Creates a new TextArea instance. /// </summary> protected TextArea(TextView textView) { if (textView == null) throw new ArgumentNullException("textView"); this.textView = textView; this.Options = textView.Options; textView.SetBinding(TextView.DocumentProperty, new Binding(DocumentProperty.Name) { Source = this }); textView.SetBinding(TextView.OptionsProperty, new Binding(OptionsProperty.Name) { Source = this }); textView.Services.AddService(typeof(TextArea), this); leftMargins.Add(new LineNumberMargin { TextView = textView, TextArea = this } ); leftMargins.Add(new Line { X1 = 0, Y1 = 0, X2 = 0, Y2 = 1, StrokeDashArray = { 0, 2 }, Stretch = Stretch.Fill, Stroke = Brushes.Gray, StrokeThickness = 1, StrokeDashCap = PenLineCap.Round, Margin = new Thickness(2, 0, 2, 0) }); textView.LineTransformers.Add(new SelectionColorizer(this)); textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace); caret = new Caret(this); caret.PositionChanged += (sender, e) => RequestSelectionValidation(); this.DefaultInputHandler = new TextAreaDefaultInputHandler(this); this.ActiveInputHandler = this.DefaultInputHandler; }
public void Draw(TextView textView, DrawingContext drawingContext) { textView.EnsureVisualLines(); #region Highlight Error Tokens var errorsToVisualize = _solution.ErrorService.GetErrorsFromDocument(_codeitem); foreach(var err in errorsToVisualize) { if(err.Range != null) { foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, err.Range)) { //drawingContext.DrawRectangle(null, _errorPen, r); drawingContext.DrawLine(_errorPen, r.BottomLeft, r.BottomRight); } } else { var line = _editor.Document.GetLineByNumber(err.StartLine); if(line != null) { var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset }; foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { drawingContext.DrawRectangle(_errorBrush, _errorPen, r); } } } } #endregion }
public BracketHighlightRenderer(TextView textView, LanguageContext languageContext) { _languageContext = languageContext; _textView = textView; UpdateColors(DefaultBackground, DefaultBorder); }
public AutoCompleteForm(TextView view, TextControl owner, TextBufferLocation location, ITextAutoCompletionList list) { this.InitializeComponent(); this._pickedItem = string.Empty; this._list = list; foreach (TextAutoCompletionItem item in list.Items) { this._itemList.Items.Add(item); } this._view = view; this._nextHandler = this._view.AddCommandHandler(this); this._owner = owner; if (location.ColumnIndex == location.Line.Length) { this._startLocation = location.Clone(); } else { using (TextBufferSpan span = this._view.GetWordSpan(location)) { this._startLocation = span.Start.Clone(); } } this._timer = new Timer(); this._timer.Interval = 500; this._timer.Tick += new EventHandler(this.OnTimerTick); }
public void Draw(TextView textView, DrawingContext drawingContext) { if (currentReferences == null) { if (textView.VisualLines.Count == 0) return; var start = textView.VisualLines.First().FirstDocumentLine.LineNumber; var end = textView.VisualLines.Last().LastDocumentLine.LineNumber; currentReferences = new List<ISegment>(); FindCurrentReferences(start, end); } if (currentReferences.Count == 0) return; BackgroundGeometryBuilder builder = new BackgroundGeometryBuilder(); builder.CornerRadius = cornerRadius; builder.AlignToMiddleOfPixels = true; foreach (var reference in this.currentReferences) { builder.AddSegment(textView, new TextSegment() { StartOffset = reference.Offset, Length = reference.Length }); builder.CloseFigure(); } Geometry geometry = builder.CreateGeometry(); if (geometry != null) { drawingContext.DrawGeometry(backgroundBrush, borderPen, geometry); } }
protected override IElementFrame CreateBinding(TextView view, DocPoint start, DocPoint end) { if (!IsVisibleInView(view)) return null; return new TileElementFrame(base.CreateBinding(view, start, start)) { XOffset = -30, TileWidth = 11, TileHeight = 11 }; }
public InlineUIElementGenerator(TextView textView, UIElement element, ITextAnchor anchor) { this.textView = textView; this.element = element; this.anchor = anchor; this.anchor.Deleted += delegate { Remove(); }; }
public void Draw(TextView textView, DrawingContext drawingContext) { if (textView == null) { throw new ArgumentNullException("textView"); } if (drawingContext == null) { throw new ArgumentNullException("drawingContext"); } if (this.currentResults == null || !textView.VisualLinesValid) { return; } ReadOnlyCollection<VisualLine> visualLines = textView.VisualLines; if (visualLines.Count == 0) { return; } int offset = visualLines.First<VisualLine>().FirstDocumentLine.Offset; int endOffset = visualLines.Last<VisualLine>().LastDocumentLine.EndOffset; foreach (var current in this.currentResults.FindOverlappingSegments(offset, endOffset - offset)) { BackgroundGeometryBuilder backgroundGeometryBuilder = new BackgroundGeometryBuilder(); backgroundGeometryBuilder.AlignToMiddleOfPixels = true; backgroundGeometryBuilder.CornerRadius = 3.0; backgroundGeometryBuilder.AddSegment(textView, current); Geometry geometry = backgroundGeometryBuilder.CreateGeometry(); if (geometry != null) { drawingContext.DrawGeometry(this.markerBrush, this.markerPen, geometry); } } }
public void Draw(TextView textview, DrawingContext drawingContext) { if (_result != null) { var backgroundGeometryBuilder = new BackgroundGeometryBuilder { CornerRadius = 1.0, AlignToMiddleOfPixels = true }; backgroundGeometryBuilder.AddSegment(textview, new TextSegment { StartOffset = _result.OpeningBracketOffset, Length = _result.OpeningBracketLength }); backgroundGeometryBuilder.CloseFigure(); backgroundGeometryBuilder.AddSegment(textview, new TextSegment { StartOffset = _result.ClosingBracketOffset, Length = _result.ClosingBracketLength }); var geometry = backgroundGeometryBuilder.CreateGeometry(); if (_borderPen == null) { UpdateColors(DefaultBackground, DefaultBackground); } if (geometry != null) { drawingContext.DrawGeometry(_backgroundBrush, _borderPen, geometry); } } }
public void Draw(TextView textView, DrawingContext drawingContext) { if (_segments == null) return; lock (_segments) { foreach (var segment in _segments) { var startLine = textView.GetVisualLine(segment.StartLineNumber); var endLine = textView.GetVisualLine(segment.EndLineNumber); // Make sure that startLine is valid (in view) since that is where we'll start to render // the background. In case endLine is null, that means that we're outside of the view and // should render the background to the last visible line. if (startLine == null) continue; if (endLine == null) endLine = textView.VisualLines.Last(); var y = startLine.GetTextLineVisualYPosition(startLine.TextLines[0], VisualYPosition.LineTop) - _textView.ScrollOffset.Y; var yEnd = endLine.GetTextLineVisualYPosition(endLine.TextLines[0], VisualYPosition.LineBottom) - _textView.ScrollOffset.Y; var rect = new System.Windows.Rect(0, y, textView.ActualWidth, yEnd - y); drawingContext.DrawRectangle(_hightlightBrush, null, rect); } } }
internal VisualLine(TextView textView, DocumentLine firstDocumentLine) { Debug.Assert(textView != null); Debug.Assert(firstDocumentLine != null); this.textView = textView; this.FirstDocumentLine = firstDocumentLine; }
public void Draw(TextView textView, DrawingContext drawingContext) { if (this.result == null) return; BackgroundGeometryBuilder builder = new BackgroundGeometryBuilder(); builder.CornerRadius = 1; builder.AlignToMiddleOfPixels = true; builder.AddSegment(textView, new TextSegment() { StartOffset = result.OpeningBracketOffset, Length = result.OpeningBracketLength }); builder.CloseFigure(); // prevent connecting the two segments builder.AddSegment(textView, new TextSegment() { StartOffset = result.ClosingBracketOffset, Length = result.ClosingBracketLength }); Geometry geometry = builder.CreateGeometry(); //Transform highlightFixTransform = new TranslateTransform(0, 2); //geometry.Transform.Value.OffsetY = 2; if (borderPen == null) this.UpdateColors(DefaultBackground, DefaultBackground); if (result.ClosingBracketLength == 0) this.UpdateColors(InvalidBackground, InvalidBackground); else this.UpdateColors(DefaultBackground, DefaultBackground); if (geometry != null) { drawingContext.DrawGeometry(backgroundBrush, borderPen, geometry ); } }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); Table table = new Table(2, 2, true); Add(table); ShowAll(); buttonView = new Button("View"); // when this button is clicked, it'll run hello() buttonView.Clicked += (s, a) => { View(); }; textviewView = new TextView(); table.Attach(buttonView, 0, 2, 0, 1); table.Attach(textviewView, 0, 2, 1, 2); table.ShowAll(); View(); }
/// <summary> /// Adds the specified segment to the geometry. /// </summary> public void AddSegment(TextView textView, ISegment segment) { if (textView == null) throw new ArgumentNullException(nameof(textView)); Size pixelSize = PixelSnapHelpers.GetPixelSize(textView); foreach (Rect r in GetRectsForSegment(textView, segment, ExtendToFullWidthAtLineEnd)) { if (AlignToWholePixels) { AddRectangle(PixelSnapHelpers.Round(r.Left, pixelSize.Width), PixelSnapHelpers.Round(r.Top + 1, pixelSize.Height), PixelSnapHelpers.Round(r.Right, pixelSize.Width), PixelSnapHelpers.Round(r.Bottom + 1, pixelSize.Height)); } else if (AlignToMiddleOfPixels) { AddRectangle(PixelSnapHelpers.PixelAlign(r.Left, pixelSize.Width), PixelSnapHelpers.PixelAlign(r.Top + 1, pixelSize.Height), PixelSnapHelpers.PixelAlign(r.Right, pixelSize.Width), PixelSnapHelpers.PixelAlign(r.Bottom + 1, pixelSize.Height)); } else { AddRectangle(r.Left, r.Top + 1, r.Right, r.Bottom + 1); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.allocation_msg_detail_activity); context = Android.App.Application.Context; string iss_date = Intent.GetStringExtra("ISS_DATE"); made_no = Intent.GetStringExtra("MADE_NO"); tag_locate_no = Intent.GetStringExtra("TAG_LOCATE_NO"); string tag_stock_no = Intent.GetStringExtra("TAG_STOCK_NO"); string ima03 = Intent.GetStringExtra("IMA03"); string pre_get_datetime = Intent.GetStringExtra("PRE_GET_DATETIME"); datetime_0 = Intent.GetStringExtra("dateTime_0"); datetime_1 = Intent.GetStringExtra("dateTime_1"); datetime_2 = Intent.GetStringExtra("dateTime_2"); iss_no = Intent.GetStringExtra("ISS_NO"); //ActionBar actionBar = getSupportActionBar(); Android.App.ActionBar actionBar = ActionBar; if (actionBar != null) { actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_chevron_left_white_24dp); actionBar.Title = ""; } mLayoutManager = new LinearLayoutManager(context); relativeLayout = FindViewById <RelativeLayout>(Resource.Id.lookup_in_stock_list_container); progressBar = new ProgressBar(context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200); layoutParams.AddRule(LayoutRules.CenterInParent); relativeLayout.AddView(progressBar, layoutParams); progressBar.Visibility = ViewStates.Gone; s_iss_date = FindViewById <TextView>(Resource.Id.s_iss_date); sp_made_no = FindViewById <TextView>(Resource.Id.sp_made_no); s_tag_stock_no = FindViewById <TextView>(Resource.Id.s_tag_stock_no); s_tag_locate_no = FindViewById <TextView>(Resource.Id.s_tag_locate_no); s_pre_get_datetime = FindViewById <TextView>(Resource.Id.s_pre_get_datetime); s_ima03 = FindViewById <TextView>(Resource.Id.s_ima03); btnTransfer = FindViewById <Button>(Resource.Id.btnTransfer); detailRecyclerView = FindViewById <RecyclerView>(Resource.Id.allocationDetailListView); detailRecyclerView.SetLayoutManager(mLayoutManager); s_iss_date.Text = iss_date; sp_made_no.Text = made_no; s_tag_locate_no.Text = tag_locate_no; s_tag_stock_no.Text = tag_stock_no; s_ima03.Text = ima03; s_pre_get_datetime.Text = pre_get_datetime; showList.Clear(); if (AllocationMsgFragment.msgDataTable.Rows.Count > 0) { foreach (DataRow rx in AllocationMsgFragment.msgDataTable.Rows) { AllocationMsgDetailItem item = new AllocationMsgDetailItem(); //rx.setValue("scan_sp", "N"); //rx.setValue("scan_desc", ""); item.setItem_part_no(rx["part_no"].ToString()); item.setItem_ima021(rx["ima021"].ToString()); item.setItem_qty(rx["qty"].ToString()); item.setItem_src_stock_no(rx["src_stock_no"].ToString()); item.setItem_src_locate_no(rx["src_locate_no"].ToString()); item.setItem_src_batch_no(rx["src_batch_no"].ToString()); item.setItem_sfa12(rx["sfa12"].ToString()); item.setItem_scan_desc(rx["scan_desc"].ToString()); showList.Add(item); } } allocationMsgDetailItemAdapter = new AllocationMsgDetailItemAdapter(this, Resource.Layout.inspected_receive_list_detail_item, showList); allocationMsgDetailItemAdapter.ItemClick += (sender, e) => { for (int i = 0; i < showList.Count; i++) { if (i == e) { if (showList[i].isSelected()) { showList[i].setSelected(false); item_select = -1; } else { showList[i].setSelected(true); item_select = e; } } else { showList[i].setSelected(false); } } allocationMsgDetailItemAdapter.NotifyDataSetChanged(); }; allocationMsgDetailItemAdapter.ItemLongClick += (sender, e) => { Intent detailIntent = new Intent(context, typeof(AllocationMsgDetailOfDetailActivity)); detailIntent.PutExtra("PART_NO", showList[e].getItem_part_no()); detailIntent.PutExtra("IMA021", showList[e].getItem_ima021()); detailIntent.PutExtra("QTY", showList[e].getItem_qty()); detailIntent.PutExtra("SRC_STOCK_NO", showList[e].getItem_src_stock_no()); detailIntent.PutExtra("SRC_LOCATE_NO", showList[e].getItem_src_locate_no()); detailIntent.PutExtra("SRC_BATCH_NO", showList[e].getItem_src_batch_no()); detailIntent.PutExtra("SFA12", showList[e].getItem_sfa12()); detailIntent.PutExtra("SCAN_DESC", showList[e].getItem_scan_desc()); context.StartActivity(detailIntent); }; detailRecyclerView.SetAdapter(allocationMsgDetailItemAdapter); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.Registration); loc_pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); back_button = FindViewById <ImageButton>(Resource.Id.back_button); agree_licenseCB = FindViewById <CheckBox>(Resource.Id.agree_licenseCB); continueBn = FindViewById <Button>(Resource.Id.continueBn); surnameET = FindViewById <EditText>(Resource.Id.surnameET); nameET = FindViewById <EditText>(Resource.Id.nameET); patronymicET = FindViewById <EditText>(Resource.Id.patronymicET); phoneET = FindViewById <EditText>(Resource.Id.phoneET); countryRL = FindViewById <RelativeLayout>(Resource.Id.countryRL); locationRL = FindViewById <RelativeLayout>(Resource.Id.locationRL); city_valueTV = FindViewById <TextView>(Resource.Id.city_valueTV); country_valueTV = FindViewById <TextView>(Resource.Id.country_valueTV); //we use shared preferences to pass data between activities loc_pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); ISharedPreferences pref = Application.Context.GetSharedPreferences("reg_data", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); city_valueTV.Text = loc_pref.GetString("auto_city_name", String.Empty); country_valueTV.Text = loc_pref.GetString("auto_country_name", String.Empty); surnameET.Text = pref.GetString("surname", String.Empty); nameET.Text = pref.GetString("name", String.Empty); patronymicET.Text = pref.GetString("patronymic", String.Empty); phoneET.Text = pref.GetString("phone", String.Empty); edit.PutString("surname", ""); edit.PutString("name", ""); edit.PutString("patronymic", ""); edit.PutString("phone", ""); edit.Apply(); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold); surnameET.SetTypeface(tf, TypefaceStyle.Normal); nameET.SetTypeface(tf, TypefaceStyle.Normal); patronymicET.SetTypeface(tf, TypefaceStyle.Normal); phoneET.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textdsdsView1).SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textVssdiew2).SetTypeface(tf, TypefaceStyle.Normal); country_valueTV.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textVisdsdew2).SetTypeface(tf, TypefaceStyle.Normal); city_valueTV.SetTypeface(tf, TypefaceStyle.Normal); continueBn.SetTypeface(tf, TypefaceStyle.Normal); continueBn.SetBackgroundResource(Resource.Drawable.button_corners_disabled); agree_licenseCB.Click += (s, e) => { if (agree_licenseCB.Checked) { continueBn.Enabled = true; continueBn.SetBackgroundResource(Resource.Drawable.button_corners); } else { continueBn.Enabled = false; continueBn.SetBackgroundResource(Resource.Drawable.button_corners_disabled); } }; backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; continueBn.Click += (s, e) => { if (/*!String.IsNullOrEmpty(surnameET.Text) && */ !String.IsNullOrEmpty(nameET.Text) && !String.IsNullOrEmpty(phoneET.Text) /* && !String.IsNullOrEmpty(patronymicET.Text)*/) { edit.PutString("surname", surnameET.Text); edit.PutString("name", nameET.Text); edit.PutString("patronymic", patronymicET.Text); edit.PutString("phone", phoneET.Text); edit.Apply(); StartActivity(typeof(YourSpecializationActivity)); } else { Toast.MakeText(this, GetString(Resource.String.fill_all_entries), ToastLength.Short).Show(); } }; phoneET.EditorAction += (object sender, EditText.EditorActionEventArgs e) => { imm.HideSoftInputFromWindow(phoneET.WindowToken, 0); }; locationRL.Click += (s, e) => { StartActivity(typeof(RegionForSearchActivity)); }; countryRL.Click += (s, e) => { StartActivity(typeof(CountryActivity)); }; } catch { StartActivity(typeof(MainActivity)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.HangmanGame); GetDatabase(); //Copies database to phone //Connecting variables with their corresponding controls btnLetterA = FindViewById <Button>(Resource.Id.btnLetterA); btnLetterB = FindViewById <Button>(Resource.Id.btnLetterB); btnLetterC = FindViewById <Button>(Resource.Id.btnLetterC); btnLetterD = FindViewById <Button>(Resource.Id.btnLetterD); btnLetterE = FindViewById <Button>(Resource.Id.btnLetterE); btnLetterF = FindViewById <Button>(Resource.Id.btnLetterF); btnLetterG = FindViewById <Button>(Resource.Id.btnLetterG); btnLetterH = FindViewById <Button>(Resource.Id.btnLetterH); btnLetterI = FindViewById <Button>(Resource.Id.btnLetterI); btnLetterJ = FindViewById <Button>(Resource.Id.btnLetterJ); btnLetterK = FindViewById <Button>(Resource.Id.btnLetterK); btnLetterL = FindViewById <Button>(Resource.Id.btnLetterL); btnLetterM = FindViewById <Button>(Resource.Id.btnLetterM); btnLetterN = FindViewById <Button>(Resource.Id.btnLetterN); btnLetterO = FindViewById <Button>(Resource.Id.btnLetterO); btnLetterP = FindViewById <Button>(Resource.Id.btnLetterP); btnLetterQ = FindViewById <Button>(Resource.Id.btnLetterQ); btnLetterR = FindViewById <Button>(Resource.Id.btnLetterR); btnLetterS = FindViewById <Button>(Resource.Id.btnLetterS); btnLetterT = FindViewById <Button>(Resource.Id.btnLetterT); btnLetterU = FindViewById <Button>(Resource.Id.btnLetterU); btnLetterV = FindViewById <Button>(Resource.Id.btnLetterV); btnLetterW = FindViewById <Button>(Resource.Id.btnLetterW); btnLetterX = FindViewById <Button>(Resource.Id.btnLetterX); btnLetterY = FindViewById <Button>(Resource.Id.btnLetterY); btnLetterZ = FindViewById <Button>(Resource.Id.btnLetterZ); imgHanging = FindViewById <ImageView>(Resource.Id.imageView1); lblScore = FindViewById <TextView>(Resource.Id.lblScore); linearWordAnswer = FindViewById <LinearLayout>(Resource.Id.linearLayoutWord); //Adding custom font lblScore.SetTypeface(tf, TypefaceStyle.Normal); //Textview Settings that we must define in the code as the Textview is created through the code linearWordAnswer.SetBackgroundColor(Color.Transparent); linearWordAnswer.Orientation = Orientation.Horizontal; linearWordAnswer.SetPadding(10, 10, 10, 10); objDb = new DatabaseManager(); wordslist = objDb.ViewAllWords(); //Gets list of words from the DatabaseManager GetWord(); //Selects a random word from the list we just created //Click actions that use the same event. Will check if the letter is correct or not. btnLetterA.Click += btnLetter_Click; btnLetterB.Click += btnLetter_Click; btnLetterC.Click += btnLetter_Click; btnLetterD.Click += btnLetter_Click; btnLetterE.Click += btnLetter_Click; btnLetterF.Click += btnLetter_Click; btnLetterG.Click += btnLetter_Click; btnLetterH.Click += btnLetter_Click; btnLetterI.Click += btnLetter_Click; btnLetterJ.Click += btnLetter_Click; btnLetterK.Click += btnLetter_Click; btnLetterL.Click += btnLetter_Click; btnLetterM.Click += btnLetter_Click; btnLetterN.Click += btnLetter_Click; btnLetterO.Click += btnLetter_Click; btnLetterP.Click += btnLetter_Click; btnLetterQ.Click += btnLetter_Click; btnLetterR.Click += btnLetter_Click; btnLetterS.Click += btnLetter_Click; btnLetterT.Click += btnLetter_Click; btnLetterU.Click += btnLetter_Click; btnLetterV.Click += btnLetter_Click; btnLetterW.Click += btnLetter_Click; btnLetterX.Click += btnLetter_Click; btnLetterY.Click += btnLetter_Click; btnLetterZ.Click += btnLetter_Click; }
public void Include(TextView text) { text.TextChanged += (sender, args) => text.Text = "" + text.Text; text.Hint = "" + text.Hint; }
public override void HandleMessage (Message msg) { switch (msg.What) { case MESSAGE_STATE_CHANGE: if (Debug) Log.Info (TAG, "MESSAGE_STATE_CHANGE: " + msg.Arg1); switch (msg.Arg1) { case BluetoothSerialService.STATE_CONNECTED: roverSetup.title.SetText (Resource.String.title_connected_to); roverSetup.title.Append (roverSetup.connectedDeviceName); roverSetup.conversationArrayAdapter.Clear (); break; case BluetoothSerialService.STATE_CONNECTING: roverSetup.title.SetText (Resource.String.title_connecting); break; case BluetoothSerialService.STATE_LISTEN: case BluetoothSerialService.STATE_NONE: roverSetup.title.SetText (Resource.String.title_not_connected); break; } break; case MESSAGE_WRITE: byte[] writeBuf = (byte[])msg.Obj; // construct a string from the buffer var writeMessage = new Java.Lang.String (writeBuf); roverSetup.conversationArrayAdapter.Add ("CMD: " + writeMessage); break; case MESSAGE_READ: byte[] readBuf = (byte[])msg.Obj; // construct a string from the valid bytes in the buffer var readMessage = new Java.Lang.String (readBuf, 0, msg.Arg1); if (readMessage.Contains("~") && !wf) { //Thread.Sleep (10000); //roverSetup.SendMessage (new Java.Lang.String ("\n\n\necho start")); Thread.Sleep (5000); roverSetup.SendMessage (new Java.Lang.String ("iwlist wlan0 scan | grep ESSID | sed 's\\[ ]*ESSID:\\wifi:\\g'")); } if (readMessage.StartsWith("wifi:")) { wf = true; string[] wifi = readMessage.Split(":"); if (!roverSetup.wifinetworks.ContainsKey(wifi[1])) roverSetup.wifinetworks.Add (wifi [1],null); Log.Debug (TAG, "wifi " + wifi[1]); var aLabel = new TextView(Application.Context); aLabel.Text = wifi[1]; var aText = new EditText(Application.Context); roverSetup.layout.AddView (aLabel); roverSetup.layout.AddView (aText); roverSetup.SetContentView( } roverSetup.conversationArrayAdapter.Add (readMessage); break; case MESSAGE_DEVICE_NAME: // save the connected device's name roverSetup.connectedDeviceName = msg.Data.GetString (DEVICE_NAME); Toast.MakeText (Application.Context, "Connected to " + roverSetup.connectedDeviceName, ToastLength.Short).Show (); break; case MESSAGE_TOAST: Toast.MakeText (Application.Context, msg.Data.GetString (TOAST), ToastLength.Short).Show (); break; } }
public YouTubeGroupViewHolder(View itemView) : base(itemView) { _title = itemView.FindViewById <TextView>(Resource.Id.Title); }
protected override void OnCreate(Bundle savedInstanceState) { if (ConfigurationManager.AppSettings == null) { ConfigurationManager.Initialise(PortableStream.Current); } base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); nonOriginal = Boolean.Parse(ConfigurationManager.AppSettings["NonOriginalController"]); xG = new List <int>(); yG = new List <int>(); zG = new List <int>(); xA = new List <int>(); yA = new List <int>(); zA = new List <int>(); caliData = new List <KeyValuePair <string, float[]> > { new KeyValuePair <string, float[]>("0", new float[6] { 0, 0, 0, -710, 0, 0 }) }; con1 = new Button(this); con1.SetBackgroundResource(Resource.Drawable.cross); con2 = new Button(this); con2.SetBackgroundResource(Resource.Drawable.cross); con3 = new Button(this); con3.SetBackgroundResource(Resource.Drawable.cross); con4 = new Button(this); con4.SetBackgroundResource(Resource.Drawable.cross); loc1 = new Button(this); con1.Text = "Locate"; loc2 = new Button(this); con2.Text = "Locate"; loc3 = new Button(this); con3.Text = "Locate"; loc4 = new Button(this); con4.Text = "Locate"; /* * con1 = FindViewById<Button>(Resource.Id.con1); * con2 = FindViewById<Button>(Resource.Id.con2); * con3 = FindViewById<Button>(Resource.Id.con3); * con4 = FindViewById<Button>(Resource.Id.con4); * * loc1 = FindViewById<Button>(Resource.Id.loc1); * loc2 = FindViewById<Button>(Resource.Id.loc2); * loc3 = FindViewById<Button>(Resource.Id.loc3); * loc4 = FindViewById<Button>(Resource.Id.loc4);*/ con = new List <Button> { con1, con2, con3, con4 }; loc = new List <Button> { loc1, loc2, loc3, loc4 }; console = this.FindViewById <TextView>(Resource.Id.console); Config.Init(caliData, PackageName); Program.Start(this); }
private void InitComponent() { try { ImageUser = FindViewById <ImageView>(Resource.Id.imageUser); NameUser = FindViewById <TextView>(Resource.Id.nameUser); TxtSubTitle = FindViewById <TextView>(Resource.Id.subTitle); CircleCommentsPoint = FindViewById <TextView>(Resource.Id.circleCommentsPoint); IconCommentsPoint = FindViewById <TextView>(Resource.Id.IconCommentsPoint); TextCommentsPoint = FindViewById <TextView>(Resource.Id.TextCommentsPoint); CircleCreatePostPoint = FindViewById <TextView>(Resource.Id.circleCreatePostPoint); IconCreatePostPoint = FindViewById <TextView>(Resource.Id.IconCreatePostPoint); TextCreatePostPoint = FindViewById <TextView>(Resource.Id.TextCreatePostPoint); ReactingPointLayouts = FindViewById <RelativeLayout>(Resource.Id.ReactingPointLayouts); CircleReactingPoint = FindViewById <TextView>(Resource.Id.circleReactingPoint); IconReactingPoint = FindViewById <TextView>(Resource.Id.IconReactingPoint); TextReactingPoint = FindViewById <TextView>(Resource.Id.TextReactingPoint); CircleCreateBlogPoint = FindViewById <TextView>(Resource.Id.circleCreateBlogPoint); IconCreateBlogPoint = FindViewById <TextView>(Resource.Id.IconCreateBlogPoint); TextCreateBlogPoint = FindViewById <TextView>(Resource.Id.TextCreateBlogPoint); AddWalletLayouts = FindViewById <RelativeLayout>(Resource.Id.AddWalletLayouts); TextAddWallet = FindViewById <TextView>(Resource.Id.TextAddWallet); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleCommentsPoint, FontAwesomeIcon.Circle); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleCreatePostPoint, FontAwesomeIcon.Circle); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleReactingPoint, FontAwesomeIcon.Circle); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, CircleCreateBlogPoint, FontAwesomeIcon.Circle); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, IconCommentsPoint, FontAwesomeIcon.CommentAlt); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeRegular, IconCreatePostPoint, FontAwesomeIcon.Newspaper); FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeRegular, IconCreateBlogPoint, FontAwesomeIcon.Blog); CircleCommentsPoint.SetTextColor(Color.ParseColor("#4caf50")); CircleCreatePostPoint.SetTextColor(Color.ParseColor("#2196F3")); CircleCreateBlogPoint.SetTextColor(Color.ParseColor("#7a7a7a")); MAdView = FindViewById <AdView>(Resource.Id.adView); AdsGoogle.InitAdView(MAdView, null); var myProfile = ListUtils.MyProfileList?.FirstOrDefault(); if (myProfile != null) { GlideImageLoader.LoadImage(this, myProfile.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); NameUser.Text = WoWonderTools.GetNameFinal(myProfile); TxtSubTitle.Text = GetString(Resource.String.Btn_Points) + " : " + myProfile.Points; } var setting = ListUtils.SettingsSiteList; if (setting != null) { TextCommentsPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.CommentsPoint + " " + GetString(Resource.String.Lbl_ByCommentingAnyPost); TextCreatePostPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.CreatepostPoint + " " + GetString(Resource.String.Lbl_ByCreatingNewPost); TextCreateBlogPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.CreateblogPoint + " " + GetString(Resource.String.Lbl_ByCreatingNewBlog); switch (AppSettings.PostButton) { case PostButtonSystem.ReactionDefault: case PostButtonSystem.ReactionSubShine: FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeRegular, IconReactingPoint, FontAwesomeIcon.Smile); CircleReactingPoint.SetTextColor(Color.ParseColor("#FF9800")); TextReactingPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.ReactionPoint + " " + GetString(Resource.String.Lbl_ByReactingAnyPost); break; case PostButtonSystem.Wonder: FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, IconReactingPoint, FontAwesomeIcon.Exclamation); CircleReactingPoint.SetTextColor(Color.ParseColor("#b71c1c")); TextReactingPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.WondersPoint + " " + GetString(Resource.String.Lbl_ByWonderingAnyPost); break; case PostButtonSystem.DisLike: FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, IconReactingPoint, FontAwesomeIcon.ThumbsDown); CircleReactingPoint.SetTextColor(Color.ParseColor("#0D47A1")); TextReactingPoint.Text = GetString(Resource.String.Lbl_Earn) + " " + setting.DislikesPoint + " " + GetString(Resource.String.Lbl_ByDislikingAnyPost); break; case PostButtonSystem.Like: ReactingPointLayouts.Visibility = ViewStates.Gone; break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override View GetView(int position, View convertView, ViewGroup parent) { SubCategoriesListData _item = new SubCategoriesListData(); SubCategoriesListData _allitem = new SubCategoriesListData(); foreach (var myitem in Items) { if (myitem.SubCategoryNameText == MainScreenActivity._selectedsubCategoryId) { _item = myitem; } } Items.Remove(_item); Items.Insert(0, _item); foreach (var allActiveItem in Items) { if (allActiveItem.SubCategoryNameText == "Все подкатегории" || allActiveItem.SubCategoryNameText == "All subcategories") { if (Items.IndexOf(allActiveItem) != 0) { _allitem = allActiveItem; } } } if (_allitem.SubCategoryNameText == "Все подкатегории" || _allitem.SubCategoryNameText == "All subcategories") { if (Items.IndexOf(_allitem) != 0) { Items.Remove(_allitem); Items.Insert(1, _allitem); } } MainScreenActivity._subcategoriesList = Items; View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); view = inflater.Inflate(Resource.Layout.secondscreendropdownlistrow, null); } SubCategoriesListData item = Items[position]; TextView subcategoryNameTextView = (TextView)view.FindViewById(Resource.Id.CategNameTextView); ImageView checkImageView = (ImageView)view.FindViewById(Resource.Id.CheckImageView); _checkButton = (Button)view.FindViewById(Resource.Id.check_button); _checkButton.Visibility = ViewStates.Gone; subcategoryNameTextView.Text = item.SubCategoryNameText; subcategoryNameTextView.SetTextColor(Android.Graphics.Color.DarkGray); checkImageView.Visibility = ViewStates.Invisible; if (item.SubCategoryNameText == MainScreenActivity._selectedsubCategoryId) { isChecked = true; } else { isChecked = false; } if (!isChecked) { subcategoryNameTextView.SetTextColor(Android.Graphics.Color.DarkGray); checkImageView.Visibility = ViewStates.Invisible; } else { subcategoryNameTextView.SetTextColor(Color.ParseColor("#6abada")); checkImageView.Visibility = ViewStates.Visible; } //if (refCount == 0) //{ // _checkButton.Click += delegate // { // MainScreenActivity._subcategoriesListView_ItemClick(position); // refCount++; // }; //} return(view); }
void prikaziPitanje() { Console.WriteLine("11111111111"); SetContentView(Resource.Layout.KlasicnaIgraLayout2); Console.WriteLine("22222222222"); LinearLayout l1 = FindViewById <LinearLayout>(Resource.Id.tipPitanja); LinearLayout l2 = FindViewById <LinearLayout>(Resource.Id.pitanje1); LinearLayout l3 = FindViewById <LinearLayout>(Resource.Id.pitanje2); Button odgovor1 = FindViewById <Button>(Resource.Id.odgovor1); Button odgovor2 = FindViewById <Button>(Resource.Id.odgovor2); Button odgovor3 = FindViewById <Button>(Resource.Id.odgovor3); Button odgovor4 = FindViewById <Button>(Resource.Id.odgovor4); TextView tekstPitanja1 = FindViewById <TextView>(Resource.Id.tekstPitanja1); TextView tekstPitanja2 = FindViewById <TextView>(Resource.Id.tekstPitanja2); TextView imeRegije = FindViewById <TextView>(Resource.Id.imeRegijeTekst); TextView kategorijaPitanja = FindViewById <TextView>(Resource.Id.kategorijaPitanjaTekst); Console.WriteLine("333333333333"); l1.Visibility = ViewStates.Visible; l2.Visibility = ViewStates.Visible; l3.Visibility = ViewStates.Visible; //Ubacivanje pitanja string[] pitanje = dohvatiPitanje(); //imeRegije.Text = tipPitanja(slovo)[0]; //kategorijaPitanja.Text = tipPitanja(slovo)[1]; //regijaPitanja = Int32.Parse(tipPitanja(slovo)[2]); tekstPitanja1.Text = pitanje[0]; tekstPitanja2.Text = pitanje[0]; odgovor1.Text = pitanje[1]; odgovor2.Text = pitanje[2]; odgovor3.Text = pitanje[3]; odgovor4.Text = pitanje[4]; odgovor = pitanje[5]; //////////////////// l1.Visibility = ViewStates.Visible; l2.Visibility = ViewStates.Gone; l3.Visibility = ViewStates.Gone; /* l1.Rotation = 180 + stranaIgraca[igracNaPotezu] * 90; * l2.Rotation = 180 + stranaIgraca[igracNaPotezu] * 90; * l3.Rotation = 180 + stranaIgraca[igracNaPotezu] * 90;*/ AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f); animation.Duration = 1500; animation.StartOffset = 0; animation.FillAfter = true; animation.RepeatCount = 0; l1.StartAnimation(animation); pricekaj1(); }
public StatusView(string filepath, Repository vc) : base(Path.GetFileName(filepath) + " Status") { this.vc = vc; this.filepath = filepath; changeSet = vc.CreateChangeSet(filepath); main = new VBox(false, 6); widget = main; commandbar = new Toolbar(); commandbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; commandbar.IconSize = Gtk.IconSize.Menu; main.PackStart(commandbar, false, false, 0); buttonCommit = new Gtk.ToolButton(new Gtk.Image("vc-commit", Gtk.IconSize.Menu), GettextCatalog.GetString("Commit...")); buttonCommit.IsImportant = true; buttonCommit.Clicked += new EventHandler(OnCommitClicked); commandbar.Insert(buttonCommit, -1); Gtk.ToolButton btnRefresh = new Gtk.ToolButton(new Gtk.Image(Gtk.Stock.Refresh, IconSize.Menu), GettextCatalog.GetString("Refresh")); btnRefresh.IsImportant = true; btnRefresh.Clicked += new EventHandler(OnRefresh); commandbar.Insert(btnRefresh, -1); buttonRevert = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert")); buttonRevert.IsImportant = true; buttonRevert.Clicked += new EventHandler(OnRevert); commandbar.Insert(buttonRevert, -1); showRemoteStatus = new Gtk.ToolButton(new Gtk.Image("vc-remote-status", Gtk.IconSize.Menu), GettextCatalog.GetString("Show Remote Status")); showRemoteStatus.IsImportant = true; showRemoteStatus.Clicked += new EventHandler(OnShowRemoteStatusClicked); commandbar.Insert(showRemoteStatus, -1); Gtk.ToolButton btnCreatePatch = new Gtk.ToolButton(new Gtk.Image("vc-diff", Gtk.IconSize.Menu), GettextCatalog.GetString("Create Patch")); btnCreatePatch.IsImportant = true; btnCreatePatch.Clicked += new EventHandler(OnCreatePatch); commandbar.Insert(btnCreatePatch, -1); commandbar.Insert(new Gtk.SeparatorToolItem(), -1); Gtk.ToolButton btnOpen = new Gtk.ToolButton(new Gtk.Image(Gtk.Stock.Open, IconSize.Menu), GettextCatalog.GetString("Open")); btnOpen.IsImportant = true; btnOpen.Clicked += new EventHandler(OnOpen); commandbar.Insert(btnOpen, -1); commandbar.Insert(new Gtk.SeparatorToolItem(), -1); Gtk.ToolButton btnExpand = new Gtk.ToolButton(null, GettextCatalog.GetString("Expand All")); btnExpand.IsImportant = true; btnExpand.Clicked += new EventHandler(OnExpandAll); commandbar.Insert(btnExpand, -1); Gtk.ToolButton btnCollapse = new Gtk.ToolButton(null, GettextCatalog.GetString("Collapse All")); btnCollapse.IsImportant = true; btnCollapse.Clicked += new EventHandler(OnCollapseAll); commandbar.Insert(btnCollapse, -1); commandbar.Insert(new Gtk.SeparatorToolItem(), -1); Gtk.ToolButton btnSelectAll = new Gtk.ToolButton(null, GettextCatalog.GetString("Select All")); btnSelectAll.IsImportant = true; btnSelectAll.Clicked += new EventHandler(OnSelectAll); commandbar.Insert(btnSelectAll, -1); Gtk.ToolButton btnSelectNone = new Gtk.ToolButton(null, GettextCatalog.GetString("Select None")); btnSelectNone.IsImportant = true; btnSelectNone.Clicked += new EventHandler(OnSelectNone); commandbar.Insert(btnSelectNone, -1); status = new Label(""); main.PackStart(status, false, false, 0); scroller = new ScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.In; filelist = new FileTreeView(); filelist.Selection.Mode = Gtk.SelectionMode.Multiple; scroller.Add(filelist); scroller.HscrollbarPolicy = PolicyType.Automatic; scroller.VscrollbarPolicy = PolicyType.Automatic; filelist.RowActivated += OnRowActivated; filelist.DiffLineActivated += OnDiffLineActivated; CellRendererToggle cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); var crc = new CellRendererIcon(); crc.StockId = "vc-comment"; colCommit = new TreeViewColumn(); colCommit.Spacing = 2; colCommit.Widget = new Gtk.Image("vc-commit", Gtk.IconSize.Menu); colCommit.Widget.Show(); colCommit.PackStart(cellToggle, false); colCommit.PackStart(crc, false); colCommit.AddAttribute(cellToggle, "active", ColCommit); colCommit.AddAttribute(cellToggle, "visible", ColShowToggle); colCommit.AddAttribute(crc, "visible", ColShowComment); CellRendererText crt = new CellRendererText(); var crp = new CellRendererPixbuf(); TreeViewColumn colStatus = new TreeViewColumn(); colStatus.Title = GettextCatalog.GetString("Status"); colStatus.PackStart(crp, false); colStatus.PackStart(crt, true); colStatus.AddAttribute(crp, "pixbuf", ColIcon); colStatus.AddAttribute(crp, "visible", ColShowStatus); colStatus.AddAttribute(crt, "text", ColStatus); colStatus.AddAttribute(crt, "foreground", ColStatusColor); TreeViewColumn colFile = new TreeViewColumn(); colFile.Title = GettextCatalog.GetString("File"); colFile.Spacing = 2; crp = new CellRendererPixbuf(); diffRenderer = new CellRendererDiff(); colFile.PackStart(crp, false); colFile.PackStart(diffRenderer, true); colFile.AddAttribute(crp, "pixbuf", ColIconFile); colFile.AddAttribute(crp, "visible", ColShowStatus); colFile.SetCellDataFunc(diffRenderer, new TreeCellDataFunc(SetDiffCellData)); crt = new CellRendererText(); crp = new CellRendererPixbuf(); colRemote = new TreeViewColumn(); colRemote.Title = GettextCatalog.GetString("Remote Status"); colRemote.PackStart(crp, false); colRemote.PackStart(crt, true); colRemote.AddAttribute(crp, "pixbuf", ColRemoteIcon); colRemote.AddAttribute(crt, "text", ColRemoteStatus); colRemote.AddAttribute(crt, "foreground", ColStatusColor); filelist.AppendColumn(colStatus); filelist.AppendColumn(colRemote); filelist.AppendColumn(colCommit); filelist.AppendColumn(colFile); colRemote.Visible = false; filestore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string[]), typeof(string), typeof(bool), typeof(bool), typeof(string), typeof(bool), typeof(bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(bool), typeof(bool)); filelist.Model = filestore; filelist.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow); commitBox = new VBox(); HBox labBox = new HBox(); labelCommit = new Gtk.Label(GettextCatalog.GetString("Commit message:")); labelCommit.Xalign = 0; labBox.PackStart(new Gtk.Image("vc-comment", Gtk.IconSize.Menu), false, false, 0); labBox.PackStart(labelCommit, true, true, 3); commitBox.PackStart(labBox, false, false, 0); Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow(); frame.ShadowType = ShadowType.In; commitText = new TextView(); commitText.WrapMode = WrapMode.WordChar; commitText.Buffer.Changed += OnCommitTextChanged; frame.Add(commitText); commitBox.PackStart(frame, true, true, 6); VPaned paned = new VPaned(); paned.Pack1(scroller, true, true); paned.Pack2(commitBox, false, false); main.PackStart(paned, true, true, 0); main.ShowAll(); status.Visible = false; filelist.Selection.Changed += new EventHandler(OnCursorChanged); VersionControlService.FileStatusChanged += OnFileStatusChanged; filelist.HeadersClickable = true; filestore.SetSortFunc(0, CompareNodes); colStatus.SortColumnId = 0; filestore.SetSortFunc(1, CompareNodes); colRemote.SortColumnId = 1; filestore.SetSortFunc(2, CompareNodes); colCommit.SortColumnId = 2; filestore.SetSortFunc(3, CompareNodes); colFile.SortColumnId = 3; filestore.SetSortColumnId(3, Gtk.SortType.Ascending); filelist.DoPopupMenu = DoPopupMenu; StartUpdate(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Context = new LiteIDContext(); Document CurrentDoc; if (Intent.HasExtra("TargetID")) { string TargetID = Intent.GetStringExtra("TargetID"); try { CurrentDoc = Context.DocStore.GetDocumentById(TargetID); } catch { Finish(); return; } } else { Finish(); return; } SetContentView(Resource.Layout.ViewDoc); TextView docTitle = FindViewById <TextView>(Resource.Id.docTitle); docTitle.Text = CurrentDoc.Name; TextView docDate = FindViewById <TextView>(Resource.Id.docDate); docDate.Text = "Added on: " + CurrentDoc.IngestionTime.ToLongDateString(); if (CurrentDoc.TextDoc) { LinearLayout modeText = FindViewById <LinearLayout>(Resource.Id.modeText); modeText.Visibility = ViewStates.Visible; TextView docContent = FindViewById <TextView>(Resource.Id.docContent); docContent.Text = CurrentDoc.GetTextContent(); } else { LinearLayout modeFile = FindViewById <LinearLayout>(Resource.Id.modeFile); modeFile.Visibility = ViewStates.Visible; TextView docType = FindViewById <TextView>(Resource.Id.docType); docType.Text = "Type: " + CurrentDoc.MimeType; Button buttonOpen = FindViewById <Button>(Resource.Id.buttonOpen); buttonOpen.Click += delegate { string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string filename = Path.Combine(path, CurrentDoc.ID); Java.IO.File outfile = new Java.IO.File(filename); Uri extURI = FileProvider.GetUriForFile(ApplicationContext, "org.LiteID.fileprovider", outfile); Intent viewIntent = new Intent(Intent.ActionView); viewIntent.SetDataAndType(extURI, CurrentDoc.MimeType); viewIntent.AddFlags(ActivityFlags.NewTask); viewIntent.SetFlags(ActivityFlags.GrantReadUriPermission); if (viewIntent.ResolveActivity(ApplicationContext.PackageManager) != null) { StartActivity(viewIntent); } else { Toast.MakeText(this.ApplicationContext, "You don't have any apps that can open this.", ToastLength.Long).Show(); } }; } Button buttonExport = FindViewById <Button>(Resource.Id.buttonExport); Button buttonDelete = FindViewById <Button>(Resource.Id.buttonDelete); buttonExport.Click += delegate { System.Uri PackedDoc = CurrentDoc.ExportDocument(); Java.IO.File outfile = new Java.IO.File(PackedDoc.AbsolutePath); Uri extURI = FileProvider.GetUriForFile(ApplicationContext, "org.LiteID.fileprovider", outfile); Intent emailIntent = new Intent(Intent.ActionSend); emailIntent.SetType("application/octet-stream"); emailIntent.PutExtra(Intent.ExtraSubject, "LiteID Document"); emailIntent.PutExtra(Intent.ExtraText, "Attached is a verifiable LiteID document."); emailIntent.PutExtra(Intent.ExtraStream, extURI); emailIntent.AddFlags(ActivityFlags.NewTask); emailIntent.SetFlags(ActivityFlags.GrantReadUriPermission); if (emailIntent.ResolveActivity(ApplicationContext.PackageManager) != null) { IList <ResolveInfo> resInfoList = ApplicationContext.PackageManager.QueryIntentActivities(emailIntent, PackageInfoFlags.MatchDefaultOnly); foreach (ResolveInfo resolveInfo in resInfoList) { string packageName = resolveInfo.ActivityInfo.PackageName; ApplicationContext.GrantUriPermission(packageName, extURI, ActivityFlags.GrantReadUriPermission); } StartActivity(Intent.CreateChooser(emailIntent, "Share Document")); } else { Toast.MakeText(this.ApplicationContext, "You don't have any apps that can share this.", ToastLength.Long).Show(); } }; buttonDelete.Click += delegate { new AlertDialog.Builder(this) .SetIcon(Android.Resource.Drawable.IcDialogAlert) .SetTitle("Delete File") .SetMessage("Are you sure you want to permanently delete this document?") .SetPositiveButton("Yes", delegate { string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string filename = Path.Combine(path, CurrentDoc.ID); File.Delete(filename); Context.DocStore.Documents.Remove(CurrentDoc); Context.DocStore.SaveList(Context.DocStoreFile); Finish(); }) .SetNegativeButton("No", delegate { }) .Show(); }; if (CurrentDoc.OriginID == null || !CurrentDoc.OriginID.SequenceEqual(Context.Config.BlockchainID)) { LinearLayout modeRemote = FindViewById <LinearLayout>(Resource.Id.modeRemote); TextView textOriginID = FindViewById <TextView>(Resource.Id.textOriginID); Button buttonVerify = FindViewById <Button>(Resource.Id.buttonVerify); modeRemote.Visibility = ViewStates.Visible; if (CurrentDoc.OriginID != null) { textOriginID.Text = "0x" + LiteIDContext.BytesToHex(CurrentDoc.OriginID); } else { textOriginID.Text = "Local Document"; buttonVerify.Visibility = ViewStates.Gone; } buttonVerify.Click += delegate { //TODO: Implement this Toast.MakeText(this.ApplicationContext, "Verified", ToastLength.Long).Show(); }; } }
protected bool ValidateBeforeSaving() { // Require title String title = Util.GetEditText(this, Resource.Id.entry_title); if (title.Length == 0) { Toast.MakeText(this, Resource.String.error_title_required, ToastLength.Long).Show(); return(false); } if (!State.ShowPassword) { // Validate password String pass = Util.GetEditText(this, Resource.Id.entry_password); String conf = Util.GetEditText(this, Resource.Id.entry_confpassword); if (!pass.Equals(conf)) { Toast.MakeText(this, Resource.String.error_pass_match, ToastLength.Long).Show(); return(false); } } // Validate expiry date DateTime newExpiry = new DateTime(); if ((State.Entry.Expires) && (!DateTime.TryParse(Util.GetEditText(this, Resource.Id.entry_expires), out newExpiry))) { Toast.MakeText(this, Resource.String.error_invalid_expiry_date, ToastLength.Long).Show(); return(false); } State.Entry.ExpiryTime = newExpiry; LinearLayout container = (LinearLayout)FindViewById(Resource.Id.advanced_container); HashSet <string> allKeys = new HashSet <string>(); for (int i = 0; i < container.ChildCount; i++) { View ees = container.GetChildAt(i); TextView keyView = (TextView)ees.FindViewById(Resource.Id.title); string key = keyView.Text; if (String.IsNullOrEmpty(key)) { Toast.MakeText(this, Resource.String.error_string_key, ToastLength.Long).Show(); return(false); } if (allKeys.Contains(key)) { Toast.MakeText(this, GetString(Resource.String.error_string_duplicate_key, new Object[] { key }), ToastLength.Long).Show(); return(false); } allKeys.Add(key); } return(true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); // Get our UI controls from the loaded layout Button buttonBlutoothAdapter = FindViewById <Button>(Resource.Id.BlutoothAdapter); TextView textAdptName = FindViewById <TextView>(Resource.Id.BlutoothAdapterName); Button buttonStartScan = FindViewById <Button>(Resource.Id.StartScan); ListView listviewDevices = FindViewById <ListView>(Resource.Id.BluetoothDevices); // Get App context Context ctxApp = Android.App.Application.Context; //this.ApplicationContext // Check permissions if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(ctxApp, Manifest.Permission.Bluetooth) == Android.Content.PM.Permission.Denied) { Android.Support.V4.App.ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.Bluetooth }, (int)PermissionRequestCode.REQUEST_BLUETOOTH); } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(ctxApp, Manifest.Permission.BluetoothAdmin) == Android.Content.PM.Permission.Denied) { Android.Support.V4.App.ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.BluetoothAdmin }, (int)PermissionRequestCode.REQUEST_BLUETOOTH_ADMIN); } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(ctxApp, Manifest.Permission.AccessCoarseLocation) == Android.Content.PM.Permission.Denied) { Android.Support.V4.App.ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.AccessCoarseLocation }, (int)PermissionRequestCode.REQUEST_ACCESS_COARSE_LOCATION); } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(ctxApp, Manifest.Permission.AccessFineLocation) == Android.Content.PM.Permission.Denied) { Android.Support.V4.App.ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.AccessFineLocation }, (int)PermissionRequestCode.REQUEST_ACCESS_FINE_LOCATION); } receiver = new SampleReceiver(); Android.Support.V4.Content.LocalBroadcastManager.GetInstance(this).RegisterReceiver(receiver, new IntentFilter("com.xamarin.example.BLU")); // Create BluetoothAdapterService connection if (serviceConnection == null) { serviceConnection = new BlutoothAdapterServiceConnection(this); } Intent serviceToStart = new Intent(this, typeof(BlutoothAdapterService)); BindService(serviceToStart, serviceConnection, Bind.AutoCreate); // Add code to handle button clicks buttonBlutoothAdapter.Click += (sender, e) => { if (serviceConnection != null) { string strBtAdptName = serviceConnection.GetName(); textAdptName.Text = strBtAdptName; } }; ScanState scanState = ScanState.start; buttonStartScan.Click += (sender, e) => { if (serviceConnection != null) { if (scanState == ScanState.start) { if (serviceConnection.StartLeScan(this, listviewDevices)) { scanState = ScanState.stop; buttonStartScan.Text = "Stop Scan"; } } else { serviceConnection.StopLeScan(); scanState = ScanState.start; buttonStartScan.Text = "Start Scan"; } } }; listviewDevices.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { if (serviceConnection != null) { //Toast.MakeText(Application, ((TextView)args.View).Text, ToastLength.Short).Show(); string deviceName = ((TextView)args.View).Text; serviceConnection.EnumServices(deviceName); } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Notifications); Console.WriteLine("NotificationsActivity"); ImageView logo = FindViewById <ImageView> (Resource.Id.ActionBarLogo); logo.Visibility = ViewStates.Invisible; ImageView menu = FindViewById <ImageView> (Resource.Id.ActionBarMenu); menu.Visibility = ViewStates.Invisible; TextView title = FindViewById <TextView> (Resource.Id.ActionBarTitle); title.Text = "Notifications"; Button back = FindViewById <Button> (Resource.Id.ActionBarBack); back.Click += delegate { Finish(); }; Switch getNotifications = FindViewById <Switch>(Resource.Id.onOffSwitchGetNotifications); getNotifications.Click += (o, e) => { // Perform action on clicks if (getNotifications.Checked) { Toast.MakeText(this, "Checked", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Not checked", ToastLength.Short).Show(); } }; Switch breakingStories = FindViewById <Switch>(Resource.Id.onOffSwitchBreakingStories); breakingStories.Click += (o, e) => { // Perform action on clicks if (breakingStories.Checked) { Toast.MakeText(this, "Checked", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Not checked", ToastLength.Short).Show(); } }; Switch newSources = FindViewById <Switch>(Resource.Id.onOffSwitchNewSources); newSources.Click += (o, e) => { // Perform action on clicks if (newSources.Checked) { Toast.MakeText(this, "Checked", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Not checked", ToastLength.Short).Show(); } }; Switch liveScoreEvents = FindViewById <Switch>(Resource.Id.onOffSwitchLiveScoreEvents); liveScoreEvents.Click += (o, e) => { // Perform action on clicks if (liveScoreEvents.Checked) { Toast.MakeText(this, "Checked", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Not checked", ToastLength.Short).Show(); } }; // Create your application here }
void UpdateEntryFromUi(PwEntry entry) { Database db = App.Kp2a.GetDb(); EntryEditActivity act = this; entry.Strings.Set(PwDefs.TitleField, new ProtectedString(db.KpDatabase.MemoryProtection.ProtectTitle, Util.GetEditText(act, Resource.Id.entry_title))); entry.Strings.Set(PwDefs.UserNameField, new ProtectedString(db.KpDatabase.MemoryProtection.ProtectUserName, Util.GetEditText(act, Resource.Id.entry_user_name))); String pass = Util.GetEditText(act, Resource.Id.entry_password); byte[] password = StrUtil.Utf8.GetBytes(pass); entry.Strings.Set(PwDefs.PasswordField, new ProtectedString(db.KpDatabase.MemoryProtection.ProtectPassword, password)); MemUtil.ZeroByteArray(password); entry.Strings.Set(PwDefs.UrlField, new ProtectedString(db.KpDatabase.MemoryProtection.ProtectUrl, Util.GetEditText(act, Resource.Id.entry_url))); entry.Strings.Set(PwDefs.NotesField, new ProtectedString(db.KpDatabase.MemoryProtection.ProtectNotes, Util.GetEditText(act, Resource.Id.entry_comment))); // Validate expiry date DateTime newExpiry = new DateTime(); if ((State.Entry.Expires) && (!DateTime.TryParse(Util.GetEditText(this, Resource.Id.entry_expires), out newExpiry))) { //ignore here } else { State.Entry.ExpiryTime = newExpiry; } // Delete all non standard strings var keys = entry.Strings.GetKeys(); foreach (String key in keys) { if (PwDefs.IsStandardField(key) == false) { entry.Strings.Remove(key); } } LinearLayout container = (LinearLayout)FindViewById(Resource.Id.advanced_container); for (int index = 0; index < container.ChildCount; index++) { View view = container.GetChildAt(index); TextView keyView = (TextView)view.FindViewById(Resource.Id.title); String key = keyView.Text; if (String.IsNullOrEmpty(key)) { continue; } TextView valueView = (TextView)view.FindViewById(Resource.Id.value); String value = valueView.Text; bool protect = ((CheckBox)view.FindViewById(Resource.Id.protection)).Checked; entry.Strings.Set(key, new ProtectedString(protect, value)); } entry.OverrideUrl = Util.GetEditText(this, Resource.Id.entry_override_url); List <string> vNewTags = StrUtil.StringToTags(Util.GetEditText(this, Resource.Id.entry_tags)); entry.Tags.Clear(); foreach (string strTag in vNewTags) { entry.AddTag(strTag); } /*KPDesktop * * * m_atConfig.Enabled = m_cbAutoTypeEnabled.Checked; * m_atConfig.ObfuscationOptions = (m_cbAutoTypeObfuscation.Checked ? * AutoTypeObfuscationOptions.UseClipboard : * AutoTypeObfuscationOptions.None); * * SaveDefaultSeq(); * * newEntry.AutoType = m_atConfig; */ }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_detail); // Toolbar toolbar = FindViewById(Resource.Idtoolbar); // setSupportActionBar(toolbar); Android.Support.V7.App.ActionBar actionBar = SupportActionBar; if (actionBar != null) { actionBar.SetDisplayHomeAsUpEnabled(true); } FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; // get title and switch button TitleText = FindViewById <TextView>(Resource.Id.textTitle); Switch = FindViewById <ImageButton>(Resource.Id.button_switch); Switch.Click += (sender, args) => { View v = (View)sender; switch (Option) { case OPTION_GOODS_ISSUE: Option = OPTION_GOODS_RETURN; TitleText.SetText(Resource.String.activity_goods_return); break; case OPTION_GOODS_RETURN: Option = OPTION_GOODS_ISSUE; TitleText.SetText(Resource.String.activity_goods_issue); break; } }; Save = FindViewById <Button>(Resource.Id.button_save); Save.Click += (sender, args) => { OnSave(); }; // get edit text controls WorkOrder = FindViewById <EditText>(Resource.Id.editWorkOrder); CostCenter = FindViewById <EditText>(Resource.Id.editCostCenter); Material = FindViewById <EditText>(Resource.Id.editMaterial); Plant = FindViewById <EditText>(Resource.Id.editPlant); StorageLocation = FindViewById <EditText>(Resource.Id.editStorageLocation); Bin = FindViewById <EditText>(Resource.Id.editBin); Quantity = FindViewById <EditText>(Resource.Id.editQuantity); Inventory = FindViewById <EditText>(Resource.Id.editInventory); Vendor = FindViewById <EditText>(Resource.Id.editVendor); // set validation watchers // WorkOrder.AddTextChangedListener(WorkOrderWatcher); // CostCenter.AddTextChangedListener(CostCenterWatcher); // Inventory.AddTextChangedListener(InventoryWatcher); // Material.AddTextChangedListener(MaterialWatcher); // Plant.AddTextChangedListener(PlantWatcher); // StorageLocation.AddTextChangedListener(StorageLocationWatcher); // Bin.AddTextChangedListener(BinWatcher); // Vendor.AddTextChangedListener(VendorWatcher); // Quantity.AddTextChangedListener(QuantityWatcher); WorkOrder.AfterTextChanged += (sender, args) => { ValidateWorkOrder(args.Editable); }; CostCenter.AfterTextChanged += (sender, args) => { ValidateCostCenter(args.Editable); }; Inventory.AfterTextChanged += (sender, args) => { ValidateInventory(args.Editable); }; Material.AfterTextChanged += (sender, args) => { ValidateMaterial(args.Editable); }; Plant.AfterTextChanged += (sender, args) => { ValidatePlant(args.Editable); }; StorageLocation.AfterTextChanged += (sender, args) => { ValidateStorageLocation(args.Editable); }; Bin.AfterTextChanged += (sender, args) => { ValidateBin(args.Editable); }; Vendor.AfterTextChanged += (sender, args) => { ValidateVendor(args.Editable); }; Quantity.AfterTextChanged += (sender, args) => { ValidateQuantity(args.Editable); }; // get option from intent, if any Intent intent = Intent; string data = intent.GetStringExtra(EXTRA_OPTION); Option = (data.Length != 0) ? data : OPTION_GOODS_ISSUE; // load last used values first ISharedPreferences sharedPref = GetPreferences(FileCreationMode.Private); WorkOrder.Text = sharedPref.GetString(EXTRA_WORK_ORDER, "");; CostCenter.Text = sharedPref.GetString(EXTRA_COST_CENTER, ""); Plant.Text = sharedPref.GetString(EXTRA_PLANT, ""); StorageLocation.Text = sharedPref.GetString(EXTRA_STORAGE_LOCATION, ""); Inventory.Text = sharedPref.GetString(EXTRA_INVENTORY, ""); Vendor.Text = sharedPref.GetString(EXTRA_VENDOR, ""); // overwrite with the values from intent, if provided data = intent.GetStringExtra(EXTRA_WORK_ORDER); if (data != null && data.Length != 0) { WorkOrder.Text = data; } data = intent.GetStringExtra(EXTRA_COST_CENTER); if (data != null && data.Length != 0) { CostCenter.Text = data; } data = intent.GetStringExtra(EXTRA_MATERIAL); if (data != null && data.Length != 0) { Material.Text = data; } data = intent.GetStringExtra(EXTRA_PLANT); if (data != null && data.Length != 0) { Plant.Text = data; } data = intent.GetStringExtra(EXTRA_STORAGE_LOCATION); if (data != null && data.Length != 0) { StorageLocation.Text = data; } data = intent.GetStringExtra(EXTRA_BIN); if (data != null && data.Length != 0) { Bin.Text = data; } data = intent.GetStringExtra(EXTRA_INVENTORY); if (data != null && data.Length != 0) { Inventory.Text = data; } data = intent.GetStringExtra(EXTRA_VENDOR); if (data != null && data.Length != 0) { Vendor.Text = data; } // get defaults from preferences sharedPref = PreferenceManager.GetDefaultSharedPreferences(this); if (Plant.Length() == 0) { Plant.Text = sharedPref.GetString(KEY_PREF_DEFAULT_PLANT, ""); // if read from defaults: disable field Plant.Enabled = (Plant.Length() == 0); } if (StorageLocation.Length() == 0) { StorageLocation.Text = sharedPref.GetString(KEY_PREF_DEFAULT_STORAGE_LOCATION, ""); // if read from defaults: disable field StorageLocation.Enabled = (StorageLocation.Length() == 0); } // initialize visibility and errors InitializeVisibility(); }
public StepRowHolder(View view) : base(view) { StepIcon = view.FindViewById <ImageView>(Resource.Id.stepIcon); //Binds the imageView showing the transit mode or turn direction icon StepText = view.FindViewById <TextView>(Resource.Id.stepText); //Binds the textView showing the instructions for the step StepDistanceText = view.FindViewById <TextView>(Resource.Id.stepDistanceText); //Binds the textView showing the distance traversed in the step }
public static void ApplyFont(this TextView text, Context context, string font) { text.SetTypeface(GetTypeface(context, font), TypefaceStyle.Normal); }
public override View GetPropertyWindowLayout(Android.Content.Context context) { /** * Property Window * */ int width = (context.Resources.DisplayMetrics.WidthPixels) / 2; LinearLayout propertylayout = new LinearLayout(context); //= new LinearLayout(context); propertylayout.Orientation = Android.Widget.Orientation.Vertical; LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams( width * 2, 5); layoutParams1.SetMargins(0, 20, 0, 0); TextView drawType = new TextView(context); drawType.TextSize = 20; drawType.Text = "Draw Type"; drawType.SetPadding(5, 20, 0, 20); TextView polarAngle = new TextView(context); polarAngle.TextSize = 20; polarAngle.Text = "Angle"; polarAngle.SetPadding(5, 20, 0, 20); Spinner selectLabelMode = new Spinner(context, SpinnerMode.Dialog); polarAngleMode = new List <String>() { "Rotate 0", "Rotate 90", "Rotate 180", "Rotate 270" }; ArrayAdapter <String> dataAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, polarAngleMode); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line); selectLabelMode.Adapter = dataAdapter; selectLabelMode.ItemSelected += SelectLabelMode_ItemSelected; Spinner selectDrawType = new Spinner(context, SpinnerMode.Dialog); List <String> adapter = new List <String>() { "Area", "Line" }; ArrayAdapter <String> dataAdapter1 = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, adapter); dataAdapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line); selectDrawType.Adapter = dataAdapter1; selectDrawType.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter1.GetItem(e.Position); if (selectedItem.Equals("Area")) { polarSeries1.DrawType = PolarChartDrawType.Area; polarSeries2.DrawType = PolarChartDrawType.Area; polarSeries3.DrawType = PolarChartDrawType.Area; } else if (selectedItem.Equals("Line")) { polarSeries1.DrawType = PolarChartDrawType.Line; polarSeries2.DrawType = PolarChartDrawType.Line; polarSeries3.DrawType = PolarChartDrawType.Line; } }; SeparatorView separate = new SeparatorView(context, width * 2); separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); propertylayout.AddView(drawType); propertylayout.AddView(selectDrawType); propertylayout.AddView(polarAngle); propertylayout.AddView(selectLabelMode); propertylayout.AddView(separate, layoutParams1); return(propertylayout); }
protected override void OnCreate(Bundle savedInstanceState) { _design.ApplyDialogTheme(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.group_edit); ImageButton iconButton = (ImageButton)FindViewById(Resource.Id.icon_button); iconButton.Click += (sender, e) => { IconPickerActivity.Launch(this); }; _selectedIconId = (int)PwIcon.FolderOpen; iconButton.SetImageDrawable(App.Kp2a.GetDb().DrawableFactory.GetIconDrawable(this, App.Kp2a.GetDb().KpDatabase, (PwIcon)_selectedIconId, null, true)); Button okButton = (Button)FindViewById(Resource.Id.ok); okButton.Click += (sender, e) => { TextView nameField = (TextView)FindViewById(Resource.Id.group_name); String name = nameField.Text; if (name.Length > 0) { Intent intent = new Intent(); intent.PutExtra(KeyName, name); intent.PutExtra(KeyIconId, _selectedIconId); if (_selectedCustomIconId != null) { intent.PutExtra(KeyCustomIconId, MemUtil.ByteArrayToHexString(_selectedCustomIconId.UuidBytes)); } if (_groupToEdit != null) { intent.PutExtra(KeyGroupUuid, MemUtil.ByteArrayToHexString(_groupToEdit.Uuid.UuidBytes)); } SetResult(Result.Ok, intent); Finish(); } else { Toast.MakeText(this, Resource.String.error_no_name, ToastLength.Long).Show(); } }; if (Intent.HasExtra(KeyGroupUuid)) { string groupUuid = Intent.Extras.GetString(KeyGroupUuid); _groupToEdit = App.Kp2a.GetDb().Groups[new PwUuid(MemUtil.HexStringToByteArray(groupUuid))]; _selectedIconId = (int)_groupToEdit.IconId; _selectedCustomIconId = _groupToEdit.CustomIconUuid; TextView nameField = (TextView)FindViewById(Resource.Id.group_name); nameField.Text = _groupToEdit.Name; App.Kp2a.GetDb().DrawableFactory.AssignDrawableTo(iconButton, this, App.Kp2a.GetDb().KpDatabase, _groupToEdit.IconId, _groupToEdit.CustomIconUuid, false); SetTitle(Resource.String.edit_group_title); } else { SetTitle(Resource.String.add_group_title); } Button cancel = (Button)FindViewById(Resource.Id.cancel); cancel.Click += (sender, e) => { Intent intent = new Intent(); SetResult(Result.Canceled, intent); Finish(); }; }
public override void Setup() { var borderStyle = BorderStyle.Double; var drawMarginFrame = false; var borderThickness = new Thickness(1, 2, 3, 4); var borderBrush = Colors.Base.HotFocus.Foreground; var padding = new Thickness(1, 2, 3, 4); var background = Colors.Base.HotNormal.Foreground; var effect3D = true; var smartView = new FrameView() { X = Pos.Center(), Y = Pos.Center() - 7, Width = 40, Height = 20, Border = new Border() { BorderStyle = borderStyle, DrawMarginFrame = drawMarginFrame, BorderThickness = borderThickness, BorderBrush = borderBrush, Padding = padding, Background = background, Effect3D = effect3D }, ColorScheme = Colors.TopLevel }; var tf1 = new TextField("1234567890") { Width = 10 }; var button = new Button("Press me!") { X = Pos.Center(), Y = Pos.Center(), }; button.Clicked += () => MessageBox.Query(20, 7, "Hi", "I'm a FrameView?", "Yes", "No"); var label = new Label("I'm a FrameView") { X = Pos.Center(), Y = Pos.Center() - 3, }; var tf2 = new TextField("1234567890") { X = Pos.AnchorEnd(10), Y = Pos.AnchorEnd(1), Width = 10 }; var tv = new TextView() { Y = Pos.AnchorEnd(2), Width = 10, Height = Dim.Fill(), ColorScheme = Colors.Dialog, Text = "1234567890" }; smartView.Add(tf1, button, label, tf2, tv); Win.Add(new Label("Padding:") { X = Pos.Center() - 23, }); var paddingTopEdit = new TextField("") { X = Pos.Center() - 22, Y = 1, Width = 5 }; paddingTopEdit.TextChanging += (e) => { try { smartView.Border.Padding = new Thickness(smartView.Border.Padding.Left, int.Parse(e.NewText.ToString()), smartView.Border.Padding.Right, smartView.Border.Padding.Bottom); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; paddingTopEdit.Text = $"{smartView.Border.Padding.Top}"; Win.Add(paddingTopEdit); var paddingLeftEdit = new TextField("") { X = Pos.Center() - 30, Y = 2, Width = 5 }; paddingLeftEdit.TextChanging += (e) => { try { smartView.Border.Padding = new Thickness(int.Parse(e.NewText.ToString()), smartView.Border.Padding.Top, smartView.Border.Padding.Right, smartView.Border.Padding.Bottom); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; paddingLeftEdit.Text = $"{smartView.Border.Padding.Left}"; Win.Add(paddingLeftEdit); var paddingRightEdit = new TextField("") { X = Pos.Center() - 15, Y = 2, Width = 5 }; paddingRightEdit.TextChanging += (e) => { try { smartView.Border.Padding = new Thickness(smartView.Border.Padding.Left, smartView.Border.Padding.Top, int.Parse(e.NewText.ToString()), smartView.Border.Padding.Bottom); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; paddingRightEdit.Text = $"{smartView.Border.Padding.Right}"; Win.Add(paddingRightEdit); var paddingBottomEdit = new TextField("") { X = Pos.Center() - 22, Y = 3, Width = 5 }; paddingBottomEdit.TextChanging += (e) => { try { smartView.Border.Padding = new Thickness(smartView.Border.Padding.Left, smartView.Border.Padding.Top, smartView.Border.Padding.Right, int.Parse(e.NewText.ToString())); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; paddingBottomEdit.Text = $"{smartView.Border.Padding.Bottom}"; Win.Add(paddingBottomEdit); var replacePadding = new Button("Replace all based on top") { X = Pos.Center() - 35, Y = 5 }; replacePadding.Clicked += () => { smartView.Border.Padding = new Thickness(smartView.Border.Padding.Top); if (paddingTopEdit.Text.IsEmpty) { paddingTopEdit.Text = "0"; } paddingBottomEdit.Text = paddingLeftEdit.Text = paddingRightEdit.Text = paddingTopEdit.Text; }; Win.Add(replacePadding); Win.Add(new Label("Border:") { X = Pos.Center() + 11, }); var borderTopEdit = new TextField("") { X = Pos.Center() + 12, Y = 1, Width = 5 }; borderTopEdit.TextChanging += (e) => { try { smartView.Border.BorderThickness = new Thickness(smartView.Border.BorderThickness.Left, int.Parse(e.NewText.ToString()), smartView.Border.BorderThickness.Right, smartView.Border.BorderThickness.Bottom); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; borderTopEdit.Text = $"{smartView.Border.BorderThickness.Top}"; Win.Add(borderTopEdit); var borderLeftEdit = new TextField("") { X = Pos.Center() + 5, Y = 2, Width = 5 }; borderLeftEdit.TextChanging += (e) => { try { smartView.Border.BorderThickness = new Thickness(int.Parse(e.NewText.ToString()), smartView.Border.BorderThickness.Top, smartView.Border.BorderThickness.Right, smartView.Border.BorderThickness.Bottom); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; borderLeftEdit.Text = $"{smartView.Border.BorderThickness.Left}"; Win.Add(borderLeftEdit); var borderRightEdit = new TextField("") { X = Pos.Center() + 19, Y = 2, Width = 5 }; borderRightEdit.TextChanging += (e) => { try { smartView.Border.BorderThickness = new Thickness(smartView.Border.BorderThickness.Left, smartView.Border.BorderThickness.Top, int.Parse(e.NewText.ToString()), smartView.Border.BorderThickness.Bottom); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; borderRightEdit.Text = $"{smartView.Border.BorderThickness.Right}"; Win.Add(borderRightEdit); var borderBottomEdit = new TextField("") { X = Pos.Center() + 12, Y = 3, Width = 5 }; borderBottomEdit.TextChanging += (e) => { try { smartView.Border.BorderThickness = new Thickness(smartView.Border.BorderThickness.Left, smartView.Border.BorderThickness.Top, smartView.Border.BorderThickness.Right, int.Parse(e.NewText.ToString())); } catch { if (!e.NewText.IsEmpty) { e.Cancel = true; } } }; borderBottomEdit.Text = $"{smartView.Border.BorderThickness.Bottom}"; Win.Add(borderBottomEdit); var replaceBorder = new Button("Replace all based on top") { X = Pos.Center() + 1, Y = 5 }; replaceBorder.Clicked += () => { smartView.Border.BorderThickness = new Thickness(smartView.Border.BorderThickness.Top); if (borderTopEdit.Text.IsEmpty) { borderTopEdit.Text = "0"; } borderBottomEdit.Text = borderLeftEdit.Text = borderRightEdit.Text = borderTopEdit.Text; }; Win.Add(replaceBorder); Win.Add(new Label("BorderStyle:")); var borderStyleEnum = Enum.GetValues(typeof(BorderStyle)).Cast <BorderStyle> ().ToList(); var rbBorderStyle = new RadioGroup(borderStyleEnum.Select( e => NStack.ustring.Make(e.ToString())).ToArray()) { X = 2, Y = 1, SelectedItem = (int)smartView.Border.BorderStyle }; Win.Add(rbBorderStyle); var cbDrawMarginFrame = new CheckBox("Draw Margin Frame", smartView.Border.DrawMarginFrame) { X = Pos.AnchorEnd(20), Y = 0, Width = 5 }; cbDrawMarginFrame.Toggled += (e) => { try { smartView.Border.DrawMarginFrame = cbDrawMarginFrame.Checked; if (cbDrawMarginFrame.Checked != smartView.Border.DrawMarginFrame) { cbDrawMarginFrame.Checked = smartView.Border.DrawMarginFrame; } } catch { } }; Win.Add(cbDrawMarginFrame); rbBorderStyle.SelectedItemChanged += (e) => { smartView.Border.BorderStyle = (BorderStyle)e.SelectedItem; smartView.SetNeedsDisplay(); if (cbDrawMarginFrame.Checked != smartView.Border.DrawMarginFrame) { cbDrawMarginFrame.Checked = smartView.Border.DrawMarginFrame; } }; var cbEffect3D = new CheckBox("Draw 3D effects", smartView.Border.Effect3D) { X = Pos.AnchorEnd(20), Y = 1, Width = 5 }; Win.Add(cbEffect3D); Win.Add(new Label("Effect3D Offset:") { X = Pos.AnchorEnd(20), Y = 2 }); Win.Add(new Label("X:") { X = Pos.AnchorEnd(19), Y = 3 }); var effect3DOffsetX = new TextField("") { X = Pos.AnchorEnd(16), Y = 3, Width = 5 }; effect3DOffsetX.TextChanging += (e) => { try { smartView.Border.Effect3DOffset = new Point(int.Parse(e.NewText.ToString()), smartView.Border.Effect3DOffset.Y); } catch { if (!e.NewText.IsEmpty && e.NewText != CultureInfo.CurrentCulture.NumberFormat.NegativeSign) { e.Cancel = true; } } }; effect3DOffsetX.Text = $"{smartView.Border.Effect3DOffset.X}"; Win.Add(effect3DOffsetX); Win.Add(new Label("Y:") { X = Pos.AnchorEnd(10), Y = 3 }); var effect3DOffsetY = new TextField("") { X = Pos.AnchorEnd(7), Y = 3, Width = 5 }; effect3DOffsetY.TextChanging += (e) => { try { smartView.Border.Effect3DOffset = new Point(smartView.Border.Effect3DOffset.X, int.Parse(e.NewText.ToString())); } catch { if (!e.NewText.IsEmpty && e.NewText != CultureInfo.CurrentCulture.NumberFormat.NegativeSign) { e.Cancel = true; } } }; effect3DOffsetY.Text = $"{smartView.Border.Effect3DOffset.Y}"; Win.Add(effect3DOffsetY); cbEffect3D.Toggled += (e) => { try { smartView.Border.Effect3D = effect3DOffsetX.Enabled = effect3DOffsetY.Enabled = cbEffect3D.Checked; } catch { } }; Win.Add(new Label("Background:") { Y = 5 }); var colorEnum = Enum.GetValues(typeof(Color)).Cast <Color> ().ToList(); var rbBackground = new RadioGroup(colorEnum.Select( e => NStack.ustring.Make(e.ToString())).ToArray()) { X = 2, Y = 6, SelectedItem = (int)smartView.Border.Background }; rbBackground.SelectedItemChanged += (e) => { smartView.Border.Background = (Color)e.SelectedItem; }; Win.Add(rbBackground); Win.Add(new Label("BorderBrush:") { X = Pos.AnchorEnd(20), Y = 5 }); var rbBorderBrush = new RadioGroup(colorEnum.Select( e => NStack.ustring.Make(e.ToString())).ToArray()) { X = Pos.AnchorEnd(18), Y = 6, SelectedItem = (int)smartView.Border.BorderBrush }; rbBorderBrush.SelectedItemChanged += (e) => { smartView.Border.BorderBrush = (Color)e.SelectedItem; }; Win.Add(rbBorderBrush); Win.Add(smartView); }
private bool?UpdateDeletedDiffDimensions(DiffViewModel diffViewModel, HunkRangeInfo hunkRangeInfo) { if (hunkRangeInfo.NewHunkRange.NumberOfLines != 0) { // unexpected number of lines for a deletion hunk return(false); } var snapshot = TextView.TextBuffer.CurrentSnapshot; var followingLineNumber = hunkRangeInfo.NewHunkRange.StartingLineNumber + 1; if (followingLineNumber < 0 || followingLineNumber >= snapshot.LineCount) { return(false); } var followingLine = snapshot.GetLineFromLineNumber(followingLineNumber); if (followingLine == null) { return(null); } var span = new SnapshotSpan(followingLine.Start, followingLine.End); if (!TextView.TextViewLines.FormattedSpan.IntersectsWith(span)) { return(false); } var followingLineView = TextView.GetTextViewLineContainingBufferPosition(followingLine.Start); if (followingLineView == null) { return(false); } if (TextView.TextViewLines.LastVisibleLine.EndIncludingLineBreak < followingLineView.Start) { // starts after the last visible line return(false); } if (TextView.TextViewLines.FirstVisibleLine.Start > followingLineView.EndIncludingLineBreak) { // ends before the first visible line return(false); } double followingTop; switch (followingLineView.VisibilityState) { case VisibilityState.FullyVisible: case VisibilityState.Hidden: case VisibilityState.PartiallyVisible: followingTop = followingLineView.Top - TextView.ViewportTop; break; case VisibilityState.Unattached: // if the closest line was past the end we would have already returned followingTop = 0; break; default: // shouldn't be reachable, but definitely hide if this is the case return(false); } double center = followingTop; double height = TextView.LineHeight; diffViewModel.Top = center - (height / 2.0); diffViewModel.Height = TextView.LineHeight; return(true); }
public override Android.Views.View GetView(int position, Android.Views.View view, ViewGroup parent) { var context = BlazorWebViewService.GetCurrentActivity(); int itemType = GetItemViewType(position); int layoutId; if (itemType == TYPE_SEPARATOR) { if (mSeparator == null) { mSeparator = new Android.Views.View(context); mSeparator.LayoutParameters = new Android.Widget.ListView.LayoutParams(ViewGroup.LayoutParams.MatchParent, 2, itemType); TypedArray attr = context.ObtainStyledAttributes( new int[] { Android.Resource.Attribute.ListDivider }); mSeparator.SetBackgroundResource(attr.GetResourceId(0, 0)); attr.Recycle(); } return(mSeparator); } else if (itemType == TYPE_MENU_ITEM) { layoutId = Android.Resource.Layout.SimpleListItem1; } else if (itemType == TYPE_MENU_CHECK) { layoutId = Android.Resource.Layout.SimpleListItemChecked; } else if (itemType == TYPE_GROUP) { layoutId = Android.Resource.Layout.PreferenceCategory; } else if (itemType == TYPE_SINGLE) { layoutId = Android.Resource.Layout.SimpleListItemSingleChoice; } else if (itemType == TYPE_MULTIPLE) { layoutId = Android.Resource.Layout.SimpleListItemMultipleChoice; } else { throw new UnsupportedOperationException(); } if (view == null) { if (mInflater == null) { mInflater = LayoutInflater.From(_builder.Context); } view = mInflater.Inflate(layoutId, parent, false); } ModifiableChoice item = GetItem(position); TextView text = (TextView)view; text.Enabled = !item.Choice.Disabled; text.Text = item.ModifiableLabel; if (view is CheckedTextView) { bool selected = item.ModifiableSelected; if (itemType == TYPE_MULTIPLE) { _list.SetItemChecked(position, selected); } else { ((CheckedTextView)view).Checked = selected; } } return(view); }
public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent) { try { DateTime StartDte = DateTime.Today; DateTime EndDte = DateTime.Today; var item = _dictGroup [_lstGroupID [groupPosition]]; if (convertView == null) { convertView = _activity.LayoutInflater.Inflate(Resource.Layout.ListControl_BookingChild, null); } TextView tvRoom = convertView.FindViewById <TextView> (Resource.Id.tvRoom); TextView tvStartDate = convertView.FindViewById <TextView> (Resource.Id.tvStartDate); TextView tvTime = convertView.FindViewById <TextView> (Resource.Id.tvTime); TextView tvFinishDate = convertView.FindViewById <TextView> (Resource.Id.tvFinishDate); TextView tvGroup = convertView.FindViewById <TextView> (Resource.Id.tvGroup); TextView tvPlaces = convertView.FindViewById <TextView> (Resource.Id.tvPlaces); TextView tvWaitlist = convertView.FindViewById <TextView> (Resource.Id.tvWaitlist); Button btnViewDetails = convertView.FindViewById <Button> (Resource.Id.btnViewDetails); Button btnBook = convertView.FindViewById <Button> (Resource.Id.btnBook); if (item.StartDate != null) { // 07/31/2012 17:00:00 StartDte = DateTime.ParseExact(item.StartDate, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); } if (item.EndDate != null) { EndDte = DateTime.ParseExact(item.EndDate, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); } SetTVText(tvRoom, item.campus); SetTVText(tvStartDate, StartDte.ToShortDateString()); SetTVText(tvTime, StartDte.ToShortTimeString().Remove(5) + " - " + EndDte.ToShortTimeString().Remove(5)); // get just the time aspect from dates SetTVText(tvFinishDate, EndDte.ToShortDateString()); SetTVText(tvGroup, ((item.targetingGroup != null) ? item.targetingGroup : "No Target")); SetTVText(tvPlaces, item.maximum - item.BookingCount); SetTVText(tvWaitlist, 0); btnBook.SetTextColor(Color.White); if (btnBook.HasOnClickListeners == false) { btnBook.Click += delegate { if (tvPlaces.Text.Trim() == "0") //If there are places left in the session { new AlertDialog.Builder(_activity) .SetTitle("Session Full") .SetMessage("The session you are attempting to book is currently full, would you like to be added to the waitlist?" + " You will be automatically added to the session when a spot becomes available.") .SetCancelable(true) .SetPositiveButton("Confirm", async delegate(object sender, DialogClickEventArgs e) { await RESTClass.PostMakeWaitlist(item.WorkshopId.ToString(), Globals.LoggedStudent.studentID, Globals.LoggedStudent.studentID); }) .Show(); } else { new AlertDialog.Builder(_activity) .SetTitle("Booked") .SetMessage("Are you sure you want to book this session?") .SetCancelable(true) .SetPositiveButton("Confirm", async delegate(object sender, DialogClickEventArgs e) { await RESTClass.PostMakeBooking(item.WorkshopId.ToString(), Globals.LoggedStudent.studentID, Globals.LoggedStudent.studentID); //create calendar item // ContentValues eventValues = new ContentValues (); // // eventValues.Put (CalendarContract.Events.InterfaceConsts.CalendarId, // _calId); // eventValues.Put (CalendarContract.Events.InterfaceConsts.Title, // "Test Event from M4A"); // eventValues.Put (CalendarContract.Events.InterfaceConsts.Description, // "This is an event created from Xamarin.Android"); // eventValues.Put (CalendarContract.Events.InterfaceConsts.Dtstart, // GetDateTimeMS (2011, 12, 15, 10, 0)); // eventValues.Put (CalendarContract.Events.InterfaceConsts.Dtend, // GetDateTimeMS (2011, 12, 15, 11, 0)); // // eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, // "UTC"); // eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, // "UTC"); // // var uri = ContentResolver.Insert (CalendarContract.Events.ContentUri, // eventValues);alendarContract.Calendars.InterfaceConsts.AccountName // }; }) .Show(); } }; } return(convertView); } catch (Exception e) { throw e; } }
private bool?UpdateNormalDiffDimensions(DiffViewModel diffViewModel, HunkRangeInfo hunkRangeInfo) { if (hunkRangeInfo.NewHunkRange.NumberOfLines <= 0) { // if visible, it would have been as a deletion return(false); } var snapshot = TextView.TextBuffer.CurrentSnapshot; var startLineNumber = hunkRangeInfo.NewHunkRange.StartingLineNumber; var endLineNumber = startLineNumber + hunkRangeInfo.NewHunkRange.NumberOfLines - 1; if (startLineNumber < 0 || startLineNumber >= snapshot.LineCount || endLineNumber < 0 || endLineNumber >= snapshot.LineCount) { return(false); } var startLine = snapshot.GetLineFromLineNumber(startLineNumber); var endLine = snapshot.GetLineFromLineNumber(endLineNumber); if (startLine == null || endLine == null) { return(null); } var span = new SnapshotSpan(startLine.Start, endLine.End); if (!TextView.TextViewLines.FormattedSpan.IntersectsWith(span)) { return(false); } var startLineView = TextView.GetTextViewLineContainingBufferPosition(startLine.Start); var endLineView = TextView.GetTextViewLineContainingBufferPosition(endLine.Start); if (startLineView == null || endLineView == null) { return(false); } if (TextView.TextViewLines.LastVisibleLine.EndIncludingLineBreak < startLineView.Start) { // starts after the last visible line return(false); } if (TextView.TextViewLines.FirstVisibleLine.Start > endLineView.EndIncludingLineBreak) { // ends before the first visible line return(false); } double startTop; switch (startLineView.VisibilityState) { case VisibilityState.FullyVisible: case VisibilityState.Hidden: case VisibilityState.PartiallyVisible: startTop = startLineView.Top - TextView.ViewportTop; break; case VisibilityState.Unattached: // if the closest line was past the end we would have already returned startTop = 0; break; default: // shouldn't be reachable, but definitely hide if this is the case return(false); } double stopBottom; switch (endLineView.VisibilityState) { case VisibilityState.FullyVisible: case VisibilityState.Hidden: case VisibilityState.PartiallyVisible: stopBottom = endLineView.Bottom - TextView.ViewportTop; break; case VisibilityState.Unattached: // if the closest line was before the start we would have already returned stopBottom = TextView.ViewportHeight; break; default: // shouldn't be reachable, but definitely hide if this is the case return(false); } diffViewModel.Top = startTop; diffViewModel.Height = stopBottom - startTop; return(true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ReceptView); RelatieReceptModel relatieReceptModel = new RelatieReceptModel(); string id = Intent.GetStringExtra("id"); string userId = Intent.GetStringExtra("userId"); TextView titel = FindViewById <TextView>(Resource.Id.txtReceptTitel); TextView beschrijving = FindViewById <TextView>(Resource.Id.txtReceptBeschrijving); TextView bereidingstijd = FindViewById <TextView>(Resource.Id.txtReceptBereidingstijd); TextView ingredienten = FindViewById <TextView>(Resource.Id.txtReceptIngredienten); TextView voorbereiding = FindViewById <TextView>(Resource.Id.txtReceptVoorbereiding); TextView bereidingswijze = FindViewById <TextView>(Resource.Id.txtReceptBereidingswijze); TextView kosten = FindViewById <TextView>(Resource.Id.txtReceptKosten); ImageButton favorieten = FindViewById <ImageButton>(Resource.Id.favorietenReceptBtn); Models.ReceptModel model = new Models.ReceptModel(); Recept recept = model.GetSingleData(id); titel.Text = recept.naam; beschrijving.Text = recept.beschrijving; bereidingstijd.Text = recept.bereidingstijd; ingredienten.Text = recept.ingredienten; voorbereiding.Text = recept.voorbereiding; bereidingswijze.Text = recept.bereidingswijze; kosten.Text = recept.kosten; favorieten.Click += delegate { if (string.IsNullOrEmpty(userId)) { messageHandler(3, null); } else { if (relatieReceptModel.checkIfExists(userId, id)) { relatieReceptModel.deleteFavoriet(userId, id); messageHandler(2, loginModel.requestUser(userId)); } else { relatieReceptModel.setFavoriet(userId, id); messageHandler(1, loginModel.requestUser(userId)); } } }; void messageHandler(int switchId, Gebruiker gebruiker) { switch (switchId) { case 1: Android.App.AlertDialog.Builder popupMessage1 = new AlertDialog.Builder(this); AlertDialog alert1 = popupMessage1.Create(); alert1.SetTitle("Favoriet toegevoegd!"); alert1.SetMessage("Het recept is aan de favorieten toegevoegd van gebruiker " + gebruiker.gebruikersnaam + "."); alert1.SetButton("OK", (c, ev) => {}); alert1.Show(); break; case 2: Android.App.AlertDialog.Builder popupMessage2 = new AlertDialog.Builder(this); AlertDialog alert2 = popupMessage2.Create(); alert2.SetTitle("Favoriet verwijderd!"); alert2.SetMessage("Het recept is uit de favorieten gehaald van gebruiker " + gebruiker.gebruikersnaam + "."); alert2.SetButton("OK", (c, ev) => {}); alert2.Show(); break; case 3: Android.App.AlertDialog.Builder popupMessage3 = new AlertDialog.Builder(this); AlertDialog alert3 = popupMessage3.Create(); alert3.SetTitle("Favoriet toevoegen mislukt!"); alert3.SetMessage("U moet ingelogd zijn om gebruik te maken van deze functie."); alert3.SetButton("OK", (c, ev) => { }); alert3.Show(); break; } } }
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Android.Content.Res.Resources res = this.Resources; // Android 3.x+ still wants to show title: disable Dialog.Window.RequestFeature(WindowFeatures.NoTitle); // Create our view view = inflater.Inflate(Resource.Layout.AuthKey, container, true); if ((cds == CommonDialogStates.AuditSubscribe) || (cds == CommonDialogStates.RevokeSubscribe)) { //auth lblInput0 = view.FindViewById <TextView> (Resource.Id.lblinput0); lblInput2 = view.FindViewById <TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById <TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById <TextView> (Resource.Id.txtChannel); lblCGinput = view.FindViewById <TextView> (Resource.Id.lblCGinput); lblCGinput.Visibility = ViewStates.Invisible; txtChannelGroup = view.FindViewById <TextView> (Resource.Id.txtChannelGroup); txtChannelGroup.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById <TextView> (Resource.Id.tvAuthLabel); switch (cds) { case CommonDialogStates.AuditSubscribe: tvAuthLabel.SetText(Resource.String.audit); break; case CommonDialogStates.RevokeSubscribe: tvAuthLabel.SetText(Resource.String.revoke); break; default: tvAuthLabel.SetText(Resource.String.auth); break; } tvinput1 = view.FindViewById <TextView> (Resource.Id.lblinput1); tvinput1.SetText(Resource.String.authopt); // Handle dismiss button click btnSet = view.FindViewById <Button> (Resource.Id.btnSet); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById <Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById <Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; //end auth } else if (cds == CommonDialogStates.ChangeUuid) { lblInput0 = view.FindViewById <TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById <TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; lblCGinput = view.FindViewById <TextView> (Resource.Id.lblCGinput); lblCGinput.Visibility = ViewStates.Invisible; txtChannelGroup = view.FindViewById <TextView> (Resource.Id.txtChannelGroup); txtChannelGroup.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById <TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById <TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById <TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText(Resource.String.btnChangeUuid); tvinput1 = view.FindViewById <TextView> (Resource.Id.lblinput1); tvinput1.SetText(Resource.String.enterUuid); // Handle dismiss button click btnSet = view.FindViewById <Button> (Resource.Id.btnSet); btnSet.SetText(Resource.String.btnChangeUuid); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById <Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById <Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.DeleteUserState) { tvAuthLabel = view.FindViewById <TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText(Resource.String.deleteUserState); lblInput2 = view.FindViewById <TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById <TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; lblCGinput = view.FindViewById <TextView> (Resource.Id.lblCGinput); lblCGinput.Visibility = ViewStates.Invisible; txtChannelGroup = view.FindViewById <TextView> (Resource.Id.txtChannelGroup); txtChannelGroup.Visibility = ViewStates.Invisible; tvinput1 = view.FindViewById <TextView> (Resource.Id.lblinput1); tvinput1.SetText(Resource.String.enterUserStateKey); // Handle dismiss button click btnSet = view.FindViewById <Button> (Resource.Id.btnSet); btnSet.SetText(Resource.String.btnDelUserStateAndExit); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById <Button> (Resource.Id.btnSet2); btnSet2.SetText(Resource.String.btnDelUserStateAndMore); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById <Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.GetUserState) { tvAuthLabel = view.FindViewById <TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText(Resource.String.btnGetUserState); lblInput2 = view.FindViewById <TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById <TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; lblCGinput = view.FindViewById <TextView> (Resource.Id.lblCGinput); lblCGinput.Visibility = ViewStates.Invisible; txtChannelGroup = view.FindViewById <TextView> (Resource.Id.txtChannelGroup); txtChannelGroup.Visibility = ViewStates.Invisible; tvinput1 = view.FindViewById <TextView> (Resource.Id.lblinput1); tvinput1.Text = string.Format("{0} ({1})", res.GetString(Resource.String.uuid), res.GetString(Resource.String.optional)); // Handle dismiss button click btnSet = view.FindViewById <Button> (Resource.Id.btnSet); btnSet.SetText(Resource.String.btnGetUserState); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById <Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById <Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.WhereNow) { lblInput0 = view.FindViewById <TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById <TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; lblCGinput = view.FindViewById <TextView> (Resource.Id.lblCGinput); lblCGinput.Visibility = ViewStates.Invisible; txtChannelGroup = view.FindViewById <TextView> (Resource.Id.txtChannelGroup); txtChannelGroup.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById <TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById <TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById <TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText(Resource.String.btnWhereNow); tvinput1 = view.FindViewById <TextView> (Resource.Id.lblinput1); tvinput1.Text = string.Format("{0} ({1})", res.GetString(Resource.String.uuid), res.GetString(Resource.String.optional)); // Handle dismiss button click btnSet = view.FindViewById <Button> (Resource.Id.btnSet); btnSet.SetText(Resource.String.btnWhereNow); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById <Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById <Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.AddUserStateKeyValue) { tvAuthLabel = view.FindViewById <TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText(Resource.String.addUserState); lblInput2 = view.FindViewById <TextView> (Resource.Id.lblinput2); lblInput2.SetText(Resource.String.enterUserStateValue); tvinput1 = view.FindViewById <TextView> (Resource.Id.lblinput1); tvinput1.SetText(Resource.String.enterUserStateKey); lblCGinput = view.FindViewById <TextView> (Resource.Id.lblCGinput); lblCGinput.Visibility = ViewStates.Invisible; txtChannelGroup = view.FindViewById <TextView> (Resource.Id.txtChannelGroup); txtChannelGroup.Visibility = ViewStates.Invisible; // Handle dismiss button click btnSet = view.FindViewById <Button> (Resource.Id.btnSet); btnSet.SetText(Resource.String.btnSaveUserStateAndExit); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById <Button> (Resource.Id.btnSet2); btnSet2.SetText(Resource.String.btnDelUserStateAndMore); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById <Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } return(view); }
public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string menuPath) { base.Initialize(builders, options, menuPath); testChangedHandler = (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnDetailsTestChanged)); testService.TestSuiteChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnTestSuiteChanged)); paned = new VPaned(); VBox vbox = new VBox(); DockItemToolbar topToolbar = Window.GetToolbar(PositionType.Top); buttonRunAll = new Button(new Gtk.Image(Gtk.Stock.GoUp, IconSize.Menu)); buttonRunAll.Clicked += new EventHandler(OnRunAllClicked); buttonRunAll.Sensitive = true; buttonRunAll.TooltipText = GettextCatalog.GetString("Run all tests"); topToolbar.Add(buttonRunAll); buttonRun = new Button(new Gtk.Image(Gtk.Stock.Execute, IconSize.Menu)); buttonRun.Clicked += new EventHandler(OnRunClicked); buttonRun.Sensitive = true; buttonRun.TooltipText = GettextCatalog.GetString("Run test"); topToolbar.Add(buttonRun); buttonStop = new Button(new Gtk.Image(Gtk.Stock.Stop, IconSize.Menu)); buttonStop.Clicked += new EventHandler(OnStopClicked); buttonStop.Sensitive = false; buttonStop.TooltipText = GettextCatalog.GetString("Cancel running test"); topToolbar.Add(buttonStop); topToolbar.ShowAll(); vbox.PackEnd(base.Control, true, true, 0); vbox.FocusChain = new Gtk.Widget [] { base.Control }; paned.Pack1(vbox, true, true); detailsPad = new VBox(); EventBox eb = new EventBox(); HBox header = new HBox(); eb.Add(header); detailLabel = new HeaderLabel(); detailLabel.Padding = 6; Button hb = new Button(new Gtk.Image("gtk-close", IconSize.SmallToolbar)); hb.Relief = ReliefStyle.None; hb.Clicked += new EventHandler(OnCloseDetails); header.PackEnd(hb, false, false, 0); hb = new Button(new Gtk.Image("gtk-go-back", IconSize.SmallToolbar)); hb.Relief = ReliefStyle.None; hb.Clicked += new EventHandler(OnGoBackTest); header.PackEnd(hb, false, false, 0); header.Add(detailLabel); Gdk.Color hcol = eb.Style.Background(StateType.Normal); hcol.Red = (ushort)(((double)hcol.Red) * 0.9); hcol.Green = (ushort)(((double)hcol.Green) * 0.9); hcol.Blue = (ushort)(((double)hcol.Blue) * 0.9); // eb.ModifyBg (StateType.Normal, hcol); detailsPad.PackStart(eb, false, false, 0); VPaned panedDetails = new VPaned(); panedDetails.BorderWidth = 3; VBox boxPaned1 = new VBox(); chart = new TestChart(); chart.ButtonPressEvent += OnChartButtonPress; chart.SelectionChanged += new EventHandler(OnChartDateChanged); chart.HeightRequest = 50; Toolbar toolbar = new Toolbar(); toolbar.IconSize = IconSize.SmallToolbar; toolbar.ToolbarStyle = ToolbarStyle.Icons; toolbar.ShowArrow = false; ToolButton but = new ToolButton("gtk-zoom-in"); but.Clicked += new EventHandler(OnZoomIn); toolbar.Insert(but, -1); but = new ToolButton("gtk-zoom-out"); but.Clicked += new EventHandler(OnZoomOut); toolbar.Insert(but, -1); but = new ToolButton("gtk-go-back"); but.Clicked += new EventHandler(OnChartBack); toolbar.Insert(but, -1); but = new ToolButton("gtk-go-forward"); but.Clicked += new EventHandler(OnChartForward); toolbar.Insert(but, -1); but = new ToolButton("gtk-goto-last"); but.Clicked += new EventHandler(OnChartLast); toolbar.Insert(but, -1); boxPaned1.PackStart(toolbar, false, false, 0); boxPaned1.PackStart(chart, true, true, 0); panedDetails.Pack1(boxPaned1, false, false); // Detailed test information -------- infoBook = new ButtonNotebook(); infoBook.PageLoadRequired += new EventHandler(OnPageLoadRequired); // Info - Group summary Frame tf = new Frame(); ScrolledWindow sw = new ScrolledWindow(); detailsTree = new TreeView(); detailsTree.HeadersVisible = true; detailsTree.RulesHint = true; detailsStore = new ListStore(typeof(object), typeof(string), typeof(string), typeof(string), typeof(string)); CellRendererText trtest = new CellRendererText(); CellRendererText tr; TreeViewColumn col3 = new TreeViewColumn(); col3.Expand = false; // col3.Alignment = 0.5f; col3.Widget = new Gtk.Image(CircleImage.Success); col3.Widget.Show(); tr = new CellRendererText(); // tr.Xalign = 0.5f; col3.PackStart(tr, false); col3.AddAttribute(tr, "markup", 2); detailsTree.AppendColumn(col3); TreeViewColumn col4 = new TreeViewColumn(); col4.Expand = false; // col4.Alignment = 0.5f; col4.Widget = new Gtk.Image(CircleImage.Failure); col4.Widget.Show(); tr = new CellRendererText(); // tr.Xalign = 0.5f; col4.PackStart(tr, false); col4.AddAttribute(tr, "markup", 3); detailsTree.AppendColumn(col4); TreeViewColumn col5 = new TreeViewColumn(); col5.Expand = false; // col5.Alignment = 0.5f; col5.Widget = new Gtk.Image(CircleImage.NotRun); col5.Widget.Show(); tr = new CellRendererText(); // tr.Xalign = 0.5f; col5.PackStart(tr, false); col5.AddAttribute(tr, "markup", 4); detailsTree.AppendColumn(col5); TreeViewColumn col1 = new TreeViewColumn(); // col1.Resizable = true; // col1.Expand = true; col1.Title = "Test"; col1.PackStart(trtest, true); col1.AddAttribute(trtest, "markup", 1); detailsTree.AppendColumn(col1); detailsTree.Model = detailsStore; sw.Add(detailsTree); tf.Add(sw); tf.ShowAll(); TestSummaryPage = infoBook.AddPage(GettextCatalog.GetString("Summary"), tf); // Info - Regressions list tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); regressionTree = new TreeView(); regressionTree.HeadersVisible = false; regressionTree.RulesHint = true; regressionStore = new ListStore(typeof(object), typeof(string), typeof(Pixbuf)); CellRendererText trtest2 = new CellRendererText(); var pr = new CellRendererPixbuf(); TreeViewColumn col = new TreeViewColumn(); col.PackStart(pr, false); col.AddAttribute(pr, "pixbuf", 2); col.PackStart(trtest2, false); col.AddAttribute(trtest2, "markup", 1); regressionTree.AppendColumn(col); regressionTree.Model = regressionStore; sw.Add(regressionTree); tf.ShowAll(); TestRegressionsPage = infoBook.AddPage(GettextCatalog.GetString("Regressions"), tf); // Info - Failed tests list tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); failedTree = new TreeView(); failedTree.HeadersVisible = false; failedTree.RulesHint = true; failedStore = new ListStore(typeof(object), typeof(string), typeof(Pixbuf)); trtest2 = new CellRendererText(); pr = new CellRendererPixbuf(); col = new TreeViewColumn(); col.PackStart(pr, false); col.AddAttribute(pr, "pixbuf", 2); col.PackStart(trtest2, false); col.AddAttribute(trtest2, "markup", 1); failedTree.AppendColumn(col); failedTree.Model = failedStore; sw.Add(failedTree); tf.ShowAll(); TestFailuresPage = infoBook.AddPage(GettextCatalog.GetString("Failed tests"), tf); // Info - results tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); resultView = new TextView(); resultView.Editable = false; sw.Add(resultView); tf.ShowAll(); TestResultPage = infoBook.AddPage(GettextCatalog.GetString("Result"), tf); // Info - Output tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); outputView = new TextView(); outputView.Editable = false; sw.Add(outputView); tf.ShowAll(); TestOutputPage = infoBook.AddPage(GettextCatalog.GetString("Output"), tf); panedDetails.Pack2(infoBook, true, true); detailsPad.PackStart(panedDetails, true, true, 0); paned.Pack2(detailsPad, true, true); paned.ShowAll(); infoBook.HidePage(TestResultPage); infoBook.HidePage(TestOutputPage); infoBook.HidePage(TestSummaryPage); infoBook.HidePage(TestRegressionsPage); infoBook.HidePage(TestFailuresPage); detailsPad.Sensitive = false; detailsPad.Hide(); detailsTree.RowActivated += new Gtk.RowActivatedHandler(OnTestActivated); regressionTree.RowActivated += new Gtk.RowActivatedHandler(OnRegressionTestActivated); failedTree.RowActivated += new Gtk.RowActivatedHandler(OnFailedTestActivated); foreach (UnitTest t in testService.RootTests) { TreeView.AddChild(t); } }
private void CreateLayout() { // Layout params for making buttons fill page width LinearLayout.LayoutParams param = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, 1.0f ); // Button to start an edit transaction _startEditingButton = new Button(this) { Text = "Start", LayoutParameters = param }; _startEditingButton.Click += BeginTransaction; // Button to stop a transaction _stopEditingButton = new Button(this) { Text = "Stop", Enabled = false, LayoutParameters = param }; _stopEditingButton.Click += StopEditTransaction; // Button to synchronize local edits with the service _syncEditsButton = new Button(this) { Text = "Sync", Enabled = false, LayoutParameters = param }; _syncEditsButton.Click += SynchronizeEdits; // Button to add bird features _addBirdButton = new Button(this) { Text = "Add Bird", Enabled = false, LayoutParameters = param }; _addBirdButton.Click += AddNewFeature; // Button to add marine features _addMarineButton = new Button(this) { Text = "Add Marine", Enabled = false, LayoutParameters = param }; _addMarineButton.Click += AddNewFeature; // Layout to hold the first row of buttons (start, stop, sync) LinearLayout editButtonsRow1 = new LinearLayout(this) { Orientation = Orientation.Horizontal }; editButtonsRow1.AddView(_startEditingButton); editButtonsRow1.AddView(_stopEditingButton); editButtonsRow1.AddView(_syncEditsButton); // Layout to hold the second row of buttons (add bird, add marine) LinearLayout editButtonsRow2 = new LinearLayout(this) { Orientation = Orientation.Horizontal }; editButtonsRow2.AddView(_addBirdButton); editButtonsRow2.AddView(_addMarineButton); // Layout for the 'require transaction' switch LinearLayout editSwitchRow = new LinearLayout(this) { Orientation = Orientation.Horizontal }; _requireTransactionSwitch = new Switch(this) { Checked = true, Text = "Require transaction" }; _requireTransactionSwitch.CheckedChange += RequireTransactionChanged; editSwitchRow.AddView(_requireTransactionSwitch); // Progress bar _progressBar = new ProgressBar(this) { Visibility = Android.Views.ViewStates.Gone }; // Use the rest of the view to show status messages _messageTextBlock = new TextView(this); // Create the main layout LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Add the first row of buttons layout.AddView(editButtonsRow1); // Add the second row of buttons layout.AddView(editButtonsRow2); // Add the 'require transaction' switch and label layout.AddView(editSwitchRow); // Add the messages text view layout.AddView(_messageTextBlock); // Add the progress bar layout.AddView(_progressBar); // Add the map view _mapView = new MapView(this); layout.AddView(_mapView); // Add the layout to the view SetContentView(layout); }