packages/
obj/
.vs/
+bin/
# StyleCop
StyleCop.Cache
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.Linq;
+using Xamarin.Forms;
+
+namespace LibTVRefCommonPortable.Controls.ContextPopup
+{
+ public class ContextPopup : BindableObject
+ {
+ IContextPopup _contextPopup;
+
+ ObservableCollection<ContextPopupItem> _items;
+
+ static ContextPopupDirectionPriorities _priorities =
+ new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Left, ContextPopupDirection.Right, ContextPopupDirection.Down);
+
+ /// <summary>
+ /// BindableProperty. Identifies the IsAutoHidingEnabled bindable property.
+ /// </summary>
+ public static readonly BindableProperty IsAutoHidingEnabledProperty = BindableProperty.Create(nameof(IsAutoHidingEnabled), typeof(bool), typeof(ContextPopup), defaultValue: true);
+
+ /// <summary>
+ /// BindableProperty. Identifies the DirectionPriorities bindable property.
+ /// </summary>
+ public static readonly BindableProperty DirectionPrioritiesProperty = BindableProperty.Create(nameof(DirectionPriorities), typeof(ContextPopupDirectionPriorities),
+ typeof(ContextPopup), defaultValue: _priorities);
+
+ /// <summary>
+ /// BindableProperty. Identifies the SelectedIndex bindable property.
+ /// </summary>
+ public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create(nameof(SelectedIndex), typeof(int), typeof(ContextPopup), defaultValue: -1,
+ propertyChanged: OnSelectedIndexChanged, coerceValue: CoerceSelectedIndex);
+
+ /// <summary>
+ /// BindableProperty. Identifies the SelectedItem bindable property.
+ /// </summary>
+ public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(ContextPopup), null,
+ propertyChanged: OnSelectedItemChanged);
+
+ /// <summary>
+ /// The constructor, which creates a new ContextPopup instance.
+ /// </summary>
+ public ContextPopup()
+ {
+ _contextPopup = DependencyService.Get<IContextPopup>(DependencyFetchTarget.NewInstance);
+
+ _contextPopup.Dismissed += (s, e) => Dismissed?.Invoke(this, EventArgs.Empty);
+ _contextPopup.ItemSelected += (s, e) => ItemSelected?.Invoke(this, EventArgs.Empty);
+
+ _items = new ObservableCollection<ContextPopupItem>();
+ _items.CollectionChanged += ItemsCollectionChanged;
+
+ SetBinding(IsAutoHidingEnabledProperty, new Binding(nameof(IsAutoHidingEnabled), mode: BindingMode.TwoWay, source: _contextPopup));
+ SetBinding(DirectionPrioritiesProperty, new Binding(nameof(DirectionPriorities), mode: BindingMode.TwoWay, source: _contextPopup));
+ SetBinding(SelectedItemProperty, new Binding(nameof(SelectedItem), mode: BindingMode.TwoWay, source: _contextPopup));
+ }
+
+ /// <summary>
+ /// Occurs when the ContextPopup is dismissed.
+ /// </summary>
+ public event EventHandler Dismissed;
+
+ /// <summary>
+ /// Occurs when the index of the selected ContextPopupItem changes.
+ /// </summary>
+ public event EventHandler SelectedIndexChanged;
+
+ /// <summary>
+ /// Occurs when a ContextPopupItem is selected.
+ /// </summary>
+ public event EventHandler ItemSelected;
+
+ /// <summary>
+ /// Gets or sets whether ContextPopup should be hidden automatically or not when parent of ContextPopup is resized.
+ /// </summary>
+ /// <remarks>
+ /// Setting IsAutoHidingEnabled to false will not be dismissed automatically whenever such as mouse clicked its background area, language i s changed, and its parent geometry is updated(changed).
+ /// </remarks>
+ public bool IsAutoHidingEnabled
+ {
+ get { return (bool)GetValue(IsAutoHidingEnabledProperty); }
+ set { SetValue(IsAutoHidingEnabledProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets or sets the direction priorities for the ContextPopup.<br>
+ /// The position of the ContextPopup depends on the available space.
+ /// Therefore, DirectionPriorities are used to specify desired first, second, third, and fourth priorities for positioning the ContextPopup.
+ /// </summary>
+ public ContextPopupDirectionPriorities DirectionPriorities
+ {
+ get { return (ContextPopupDirectionPriorities)GetValue(DirectionPrioritiesProperty); }
+ set { SetValue(DirectionPrioritiesProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets or sets the index of the selected item of the ContextPopup.
+ /// It is -1 when no item is selected.
+ /// </summary>
+ public int SelectedIndex
+ {
+ get { return (int)GetValue(SelectedIndexProperty); }
+ set { SetValue(SelectedIndexProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected item of the ContextPopup.
+ /// </summary>
+ public ContextPopupItem SelectedItem
+ {
+ get { return (ContextPopupItem)GetValue(SelectedItemProperty); }
+ set { SetValue(SelectedItemProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets the list of items in the ContextPopup.
+ /// </summary>
+ public IList<ContextPopupItem> Items
+ {
+ get
+ {
+ return _items;
+ }
+ }
+
+ /// <summary>
+ /// Shows the ContextPopup. The ContextPopup is positioned at the horizontal and the vertical position of a specific anchor.
+ /// </summary>
+ /// <param name="anchor">The view to which the popup should be anchored.</param>
+ public void Show(View anchor)
+ {
+ Show(anchor, 0, 0);
+ }
+
+ /// <summary>
+ /// Shows the ContextPopup. The ContextPopup is positioned at the horizontal and the vertical position of a specific anchor with offsets.
+ /// </summary>
+ /// <param name="anchor">The view to which the popup should be anchored.</param>
+ /// <param name="xOffset">The horizontal offset from the anchor.</param>
+ /// <param name="yOffset">The vertical offset from the anchor.</param>
+ public void Show(View anchor, int xOffset, int yOffset)
+ {
+ _contextPopup.Show(anchor, xOffset, yOffset);
+ }
+
+ /// <summary>
+ /// Shows the ContextPopup. The ContextPopup is positioned at the horizontal and the vertical position of a specific anchor with offsets.
+ /// </summary>
+ /// <param name="anchor">The view to which the popup should be anchored.</param>
+ /// <param name="xOffset">The horizontal offset from the anchor.</param>
+ /// <param name="yOffset">The vertical offset from the anchor.</param>
+ public void Show(View anchor, double xOffset, double yOffset)
+ {
+ Show(anchor, (int)xOffset, (int)yOffset);
+ }
+
+ /// <summary>
+ /// Dismisses the ContextPopup.
+ /// </summary>
+ public void Dismiss()
+ {
+ _contextPopup.Dismiss();
+ }
+
+ /// <summary>
+ /// Gets the direction of the ContextPopup if it is shown.
+ /// This method returns false if it is not shown and the output argument is a default value.
+ /// </summary>
+ /// <param name="direction">The direction of the ContextPopup.</param>
+ /// <returns>true if the ContextPopup is shown, false otherwise.</returns>
+ public bool TryGetContextPopupDirection(out ContextPopupDirection direction)
+ {
+ direction = default(ContextPopupDirection);
+ return _contextPopup.TryGetContextPopupDirection(out direction);
+ }
+
+ void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ switch (e.Action)
+ {
+ case NotifyCollectionChangedAction.Add:
+ AddItems(e);
+ break;
+
+ case NotifyCollectionChangedAction.Remove:
+ RemoveItems(e);
+ break;
+
+ default: // Move, replace, reset
+ ResetItems();
+ break;
+ }
+
+ SelectedIndex = SelectedIndex.Clamp(-1, Items.Count - 1);
+ UpdateSelectedItem();
+ }
+
+ void ResetItems()
+ {
+ _contextPopup.ClearItems();
+ }
+
+ void RemoveItems(NotifyCollectionChangedEventArgs e)
+ {
+ _contextPopup.RemoveItems(e.OldItems.OfType<ContextPopupItem>());
+ }
+
+ void AddItems(NotifyCollectionChangedEventArgs e)
+ {
+ _contextPopup.AddItems(e.NewItems.OfType<ContextPopupItem>());
+ }
+
+ static void OnSelectedIndexChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var contextPopup = (ContextPopup)bindable;
+ contextPopup.UpdateSelectedItem();
+ contextPopup.SelectedIndexChanged?.Invoke(contextPopup, EventArgs.Empty);
+ }
+
+ static object CoerceSelectedIndex(BindableObject bindable, object value)
+ {
+ var contextPopup = (ContextPopup)bindable;
+ return contextPopup.Items == null ? -1 : ((int)value).Clamp(-1, contextPopup.Items.Count - 1);
+ }
+
+ void UpdateSelectedItem()
+ {
+ if (SelectedIndex == -1)
+ {
+ SelectedItem = null;
+ return;
+ }
+
+ SelectedItem = Items[SelectedIndex];
+ }
+
+ static void OnSelectedItemChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ if(bindable is ContextPopup _contextPopup && newValue is ContextPopupItem _newValue)
+ {
+ _contextPopup.UpdateSelectedIndex(_newValue);
+ }
+ }
+
+ void UpdateSelectedIndex(ContextPopupItem selectedItem)
+ {
+ SelectedIndex = Items.IndexOf(selectedItem);
+ }
+ }
+
+ internal static class NumericExtensions
+ {
+ public static int Clamp(this int self, int min, int max)
+ {
+ return Math.Min(max, Math.Max(self, min));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace LibTVRefCommonPortable.Controls.ContextPopup
+{
+ /// <summary>
+ /// Enumeration for the direction of a ContextPopup.
+ /// </summary>
+ public enum ContextPopupDirection
+ {
+ /// <summary>
+ /// The down ContextPopup direction.
+ /// </summary>
+ Down,
+
+ /// <summary>
+ /// The right ContextPopup direction.
+ /// </summary>
+ Right,
+
+ /// <summary>
+ /// The left ContextPopup direction.
+ /// </summary>
+ Left,
+
+ /// <summary>
+ /// The up ContextPopup direction.
+ /// </summary>
+ Up,
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace LibTVRefCommonPortable.Controls.ContextPopup
+{
+ /// <summary>
+ /// The direction priorities of a ContextPopup.
+ /// </summary>
+ public struct ContextPopupDirectionPriorities
+ {
+ /// <summary>
+ /// Creates a ContextPopupDirectionPriorities structure.
+ /// </summary>
+ /// <param name="first">The first direction priority.</param>
+ /// <param name="second">The second direction priority.</param>
+ /// <param name="third">The third direction priority.</param>
+ /// <param name="fourth">The fourth direction priority.</param>
+ public ContextPopupDirectionPriorities(ContextPopupDirection first, ContextPopupDirection second, ContextPopupDirection third, ContextPopupDirection fourth)
+ {
+ First = first;
+ Second = second;
+ Third = third;
+ Fourth = fourth;
+ }
+
+ /// <summary>
+ /// Gets the first direction priority.
+ /// </summary>
+ public ContextPopupDirection First { get; private set; }
+
+ /// <summary>
+ /// Gets the second direction priority.
+ /// </summary>
+ public ContextPopupDirection Second { get; private set; }
+
+ /// <summary>
+ /// Gets the third direction priority.
+ /// </summary>
+ public ContextPopupDirection Third { get; private set; }
+
+ /// <summary>
+ /// Gets the fourth direction priority.
+ /// </summary>
+ public ContextPopupDirection Fourth { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Xamarin.Forms;
+
+namespace LibTVRefCommonPortable.Controls.ContextPopup
+{
+ public class ContextPopupItem : INotifyPropertyChanged
+ {
+ string _label;
+ FileImageSource _icon;
+
+ /// <summary>
+ /// Creates a ContextPopupItem with only a label.
+ /// </summary>
+ /// <param name="label">The label of the ContextPopupItem.</param>
+ public ContextPopupItem(string label)
+ {
+ _label = label;
+ }
+
+ /// <summary>
+ /// Creates a ContextPopupItem with a label and an icon. The icon may be an image or a standard icon.<br>
+ /// To create a ContextPopupItem with only an icon, set the label to an empty string.<br>
+ /// The available standard icons that can be used are specified in the StandardIconResource class.
+ /// The name property of the StandardIconResource class can be used to specify a standard icon.
+ /// </summary>
+ /// <param name="label">The label of the ContextPopupItem.</param>
+ /// <param name="icon">The icon of the ContextPopupItem.</param>
+ /// <code>
+ /// new ContextPopupItem("Text only item");
+ /// new ContextPopupItem("Home icon", "home");
+ /// new ContextPopupItem("Car", "car.png");
+ /// new ContextPopupItem("Chat", StandardIconResource.MenuChat.Name);
+ /// </code>
+ public ContextPopupItem(string label, FileImageSource icon)
+ {
+ if (label == null)
+ label = "";
+ _label = label;
+ _icon = icon;
+ }
+
+ /// <summary>
+ /// Occurs when the label or an icon of a ContextPopupItem is changed.
+ /// </summary>
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ /// <summary>
+ /// Gets or sets the label of a ContextPopupItem.
+ /// </summary>
+ public string Label
+ {
+ get
+ {
+ return _label;
+ }
+ set
+ {
+ if (value != _label)
+ {
+ _label = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the icon of a ContextPopupItem. The icon may be an image or a standard icon.<br>
+ /// The available standard icons that can be used are specified in the StandardIconResource class.
+ /// The name property of the StandardIconResource class can be used to specify a standard icon.
+ /// </summary>
+ /// <remarks>
+ /// Icon is only supported on the mobile profile.
+ /// Icon does not always work as expected on the TV profile.
+ /// </remarks>
+ public FileImageSource Icon
+ {
+ get
+ {
+ return _icon;
+ }
+ set
+ {
+ if (value != _icon)
+ {
+ _icon = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Called when a bindable property has changed.
+ /// </summary>
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections.Generic;
+using Xamarin.Forms;
+
+namespace LibTVRefCommonPortable.Controls.ContextPopup
+{
+ public interface IContextPopup
+ {
+ event EventHandler ItemSelected;
+
+ event EventHandler Dismissed;
+
+ ContextPopupItem SelectedItem { get; set; }
+
+ ContextPopupDirectionPriorities DirectionPriorities { get; set; }
+
+ bool IsAutoHidingEnabled { get; set; }
+
+ void AddItems(IEnumerable<ContextPopupItem> items);
+
+ void RemoveItems(IEnumerable<ContextPopupItem> items);
+
+ void ClearItems();
+
+ void Show(View anchor, int xAnchorOffset, int yAnchorOffset);
+
+ void Dismiss();
+
+ bool TryGetContextPopupDirection(out ContextPopupDirection direction);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using Xamarin.Forms;
+
+namespace LibTVRefCommonPortable.Controls
+{
+ public class DropdownList : View
+ {
+ /// <summary>
+ /// BindableProperty. Identifies the SelectedItem bindable property.
+ /// </summary>
+ public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create("SelectedItem", typeof(object), typeof(DropdownList), default(object), BindingMode.TwoWay, propertyChanged: OnSelectedItemChanged);
+
+ [Obsolete("IsHorizontalProperty is obsolete as of version 2.3.5-r256. The orientation is always vertical.")]
+ public static readonly BindableProperty IsHorizontalProperty = BindableProperty.Create("IsHorizontal", typeof(bool), typeof(DropdownList), default(bool));
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindablePropertyKey IsExpandedPropertyKey = BindableProperty.CreateReadOnly("IsExpanded", typeof(bool), typeof(DropdownList), default(bool), propertyChanged: OnIsExpandedPropertyChanged);
+
+ /// <summary>
+ /// BindableProperty. Identifies the IsExpanded bindable property.
+ /// </summary>
+ public static readonly BindableProperty IsExpandedProperty = IsExpandedPropertyKey.BindableProperty;
+
+ /// <summary>
+ /// BindableProperty. Identifies the ItemsSource bindable property.
+ /// </summary>
+ public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(DropdownList), default(IEnumerable), propertyChanged: OnItemsSourceChanged);
+
+ /// <summary>
+ /// BindableProperty. Identifies the DisplayMemberPath bindable property.
+ /// </summary>
+ public static readonly BindableProperty DisplayMemberPathProperty = BindableProperty.Create("DisplayMemberPath", typeof(string), typeof(DropdownList), default(string));
+
+ /// <summary>
+ /// Occurs when an item in the DropdownList is selected.
+ /// SelectedItemChangedEventArgs will also have the selected item.
+ /// </summary>
+ public event EventHandler<SelectedItemChangedEventArgs> ItemSelected;
+
+ /// <summary>
+ /// Occurs when the DropdownList is expanded.
+ /// </summary>
+ public event EventHandler Expanded;
+
+ /// <summary>
+ /// Occurs when the DropdownList is collapsed.
+ /// </summary>
+ public event EventHandler Collapsed;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ExpandRequestArgs> ExpandChangeRequested;
+
+ /// <summary>
+ /// Raised when one or more items of ItemsSource is changed.
+ /// </summary>
+ public event NotifyCollectionChangedEventHandler CollectionChanged;
+
+ /// <summary>
+ /// Gets or sets the currently selected item from the DropdownList.ItemsSource.
+ /// </summary>
+ public object SelectedItem
+ {
+ get { return (object)GetValue(SelectedItemProperty); }
+ set { SetValue(SelectedItemProperty, value); }
+ }
+
+ [Obsolete("IsHorizontal is obsolete as of version 2.3.5-r256. The orientation is always vertical.")]
+ public bool IsHorizontal
+ {
+ get { return (bool)GetValue(IsHorizontalProperty); }
+ set { SetValue(IsHorizontalProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets the flag of whether the dropdownlist is expanded.
+ /// </summary>
+ public bool IsExpanded
+ {
+ get { return (bool)GetValue(IsExpandedProperty); }
+ }
+
+ /// <summary>
+ /// Gets or sets the source of items to template and display.
+ /// </summary>
+ public IEnumerable ItemsSource
+ {
+ get { return (IEnumerable)GetValue(ItemsSourceProperty); }
+ set { SetValue(ItemsSourceProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets or sets a member path to a value on the ItemsSource.
+ /// </summary>
+ public string DisplayMemberPath
+ {
+ get { return (string)GetValue(DisplayMemberPathProperty); }
+ set { SetValue(DisplayMemberPathProperty, value); }
+ }
+
+ /// <summary>
+ /// Expands the DropdownList popup from code.
+ /// </summary>
+ public void Expand()
+ {
+ if (!IsExpanded)
+ {
+ var arg = new ExpandRequestArgs { IsExpand = true };
+ ExpandChangeRequested?.Invoke(this, arg);
+ }
+ }
+
+ /// <summary>
+ /// Collapses the DropdownList popup from code.
+ /// </summary>
+ public void Collapse()
+ {
+ if (IsExpanded)
+ {
+ var arg = new ExpandRequestArgs();
+ ExpandChangeRequested?.Invoke(this, arg);
+ }
+ }
+
+ static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ (bindable as DropdownList).OnItemsSourceChanged(oldValue as INotifyCollectionChanged, newValue as INotifyCollectionChanged);
+ }
+
+ void OnItemsSourceChanged(INotifyCollectionChanged oldValue, INotifyCollectionChanged newValue)
+ {
+ if (oldValue != null)
+ {
+ oldValue.CollectionChanged -= OnNotifyCollectionChanged;
+ }
+ if (newValue != null)
+ {
+ newValue.CollectionChanged += OnNotifyCollectionChanged;
+ }
+ }
+
+ void OnNotifyCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ CollectionChanged?.Invoke(this, e);
+ }
+
+ static void OnSelectedItemChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var dropdownList = (DropdownList)bindable;
+ dropdownList.ItemSelected?.Invoke(bindable, new SelectedItemChangedEventArgs(newValue));
+ }
+
+ static void OnIsExpandedPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
+ {
+ var element = bindable as DropdownList;
+ if (element != null)
+ {
+ var isExpanded = (bool)newvalue;
+ if (isExpanded)
+ {
+ element.Expanded?.Invoke(element, EventArgs.Empty);
+ }
+ else
+ {
+ element.Collapsed?.Invoke(element, EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ExpandRequestArgs : EventArgs
+ {
+ public bool IsExpand { get; set; }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace LibTVRefCommonPortable.Controls.Toast
+{
+ /// <summary>
+ /// This interface, which defines the ability to display simple text, is used internally.
+ /// </summary>
+ public interface IToast
+ {
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ int Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the text.
+ /// </summary>
+ string Text { get; set; }
+
+ /// <summary>
+ /// Shows the view for the specified duration.
+ /// </summary>
+ void Show();
+
+ /// <summary>
+ /// Dismisses the specified view.
+ /// </summary>
+ void Dismiss();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace LibTVRefCommonPortable.Controls.Toast
+{
+ /// <summary>
+ /// The Toast class provides properties that show simple types of messages.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// Toast.DisplayText("Hello World", 3000)
+ /// </code>
+ /// </example>
+ public sealed class Toast
+ {
+ /// <summary>
+ /// It shows the simplest form of the message.
+ /// </summary>
+ /// <param name="text">The body text of the toast.</param>
+ /// <param name="duration">How long to display the text in milliseconds.</param>
+ public static void DisplayText(string text, int duration = 3000)
+ {
+ new ToastProxy
+ {
+ Text = text,
+ Duration = duration,
+ }.Show();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using Xamarin.Forms;
+namespace LibTVRefCommonPortable.Controls.Toast
+{
+ /// <summary>
+ /// This class is for the internal use by toast.
+ /// </summary>
+ internal class ToastProxy : IToast
+ {
+ IToast _toastProxy = null;
+
+ public ToastProxy()
+ {
+ _toastProxy = DependencyService.Get<IToast>(DependencyFetchTarget.NewInstance);
+
+ if (_toastProxy == null)
+ throw new Exception("RealObject is null, Internal instance via DependecyService was not created.");
+ }
+
+ public int Duration
+ {
+ get
+ {
+ return _toastProxy.Duration;
+ }
+
+ set
+ {
+ _toastProxy.Duration = value;
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ return _toastProxy.Text;
+ }
+
+ set
+ {
+ _toastProxy.Text = value;
+ }
+ }
+
+ public void Dismiss()
+ {
+ _toastProxy.Dismiss();
+ }
+
+ public void Show()
+ {
+ _toastProxy.Show();
+ }
+ }
+}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>tizen40</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<NoWarn>$(NoWarn);NU1605</NoWarn>
+ <RootNamespace>LibTVRefCommonPortable</RootNamespace>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Tizen.Xamarin.Forms.Extension" Version="2.4.0-v00013" />
- <PackageReference Include="Xamarin.Forms" Version="2.4.0-r266-006" />
+ <PackageReference Include="Xamarin.Forms" Version="3.1.0.583944" />
</ItemGroup>
</Project>
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
- "signature": "cf5149bdff09bd8db6df7773b79e5a86c601ccd4"
+ "signature": "c00d47598a7a785aaa7a8c313a997897aee7e64c"
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0/": {
"LibCommon.Shared/1.0.0": {
"dependencies": {
- "NETStandard.Library": "2.0.0",
- "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005",
+ "NETStandard.Library": "2.0.3",
+ "Tizen.Xamarin.Forms.Extension": "2.4.0-v00013",
"Xamarin.Forms": "2.4.0.266-pre1"
},
"runtime": {
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
- "NETStandard.Library/2.0.0": {
+ "NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
- "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": {
+ "Tizen.Xamarin.Forms.Extension/2.4.0-v00013": {
"dependencies": {
"Xamarin.Forms": "2.4.0.266-pre1"
},
"runtime": {
- "lib/netstandard1.0/Tizen.Xamarin.Forms.Extension.dll": {}
+ "lib/netstandard1.0/Tizen.Xamarin.Forms.Extension.dll": {
+ "assemblyVersion": "0.0.1.0",
+ "fileVersion": "0.0.1.0"
+ }
}
},
"Xamarin.Forms/2.4.0.266-pre1": {
"runtime": {
- "lib/netstandard1.0/Xamarin.Forms.Core.dll": {},
- "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {},
- "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {}
+ "lib/netstandard1.0/Xamarin.Forms.Core.dll": {
+ "assemblyVersion": "2.0.0.0",
+ "fileVersion": "2.0.0.0"
+ },
+ "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {
+ "assemblyVersion": "1.0.0.0",
+ "fileVersion": "1.0.0.0"
+ },
+ "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {
+ "assemblyVersion": "2.0.0.0",
+ "fileVersion": "2.0.0.0"
+ }
}
}
}
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
+ "sha512": "sha512-bLpT1f/SFlO1CzqXG12KnJzpZs6lv24uX2Rzi4Fmm0noJpNlnWRVryuO3yK18Ca04t/YHcO1e1Z0WDfjseqNzw==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
- "NETStandard.Library/2.0.0": {
+ "NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-7jnbRU+L08FXKMxqUflxEXtVymWvNOrS8yHgu9s6EM8Anr6T/wIX4nZ08j/u3Asz+tCufp3YVwFSEvFTPYmBPA==",
- "path": "netstandard.library/2.0.0",
- "hashPath": "netstandard.library.2.0.0.nupkg.sha512"
+ "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
+ "path": "netstandard.library/2.0.3",
+ "hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
- "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": {
+ "Tizen.Xamarin.Forms.Extension/2.4.0-v00013": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-MKUamVt5XloZ/JziyOXLdbahn7T0LDQDJGUt3ynt0iSia4aLpZLOua6/iypBhnC79FgMaNfUA7APjVfjh3NLTg==",
- "path": "tizen.xamarin.forms.extension/2.4.0-v00005",
- "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00005.nupkg.sha512"
+ "sha512": "sha512-sOfaxQdXEYrMPMSmbn8/0Y4Q/K+1mnaQ4k2CM275b2C+aVhZOAQEqRVq7xCLZyNsCeZLLKPTbVhpeIirluDIOw==",
+ "path": "tizen.xamarin.forms.extension/2.4.0-v00013",
+ "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00013.nupkg.sha512"
},
"Xamarin.Forms/2.4.0.266-pre1": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-pMu+b01vdH1ul5EJo1opQjEcwisWT35DdZO6EuR9HNKfY1dWyKmAlWgRdGUtjtdbhjOAtCOQUxI7F3x4hvV8KA==",
+ "sha512": "sha512-kCftdF7OBbO/SmsIyG/7SjKWoxQZCqxC+MSEbtDc4VWmYcuZsDCUK4pXWRpvwUp5MGdfAec87+AQ7yrlEvBMMQ==",
"path": "xamarin.forms/2.4.0.266-pre1",
"hashPath": "xamarin.forms.2.4.0.266-pre1.nupkg.sha512"
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>tizen40</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<NoWarn>$(NoWarn);NU1605</NoWarn>
+ <RootNamespace>LibTVRefCommonTizen</RootNamespace>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00224" />
- <PackageReference Include="Tizen.Xamarin.Forms.Extension" Version="2.4.0-v00013" />
- <PackageReference Include="Xamarin.Forms" Version="2.4.0-r266-006" />
- <PackageReference Include="Xamarin.Forms.Platform.Tizen" Version="2.4.0-r266-006" />
+ <PackageReference Include="Tizen.NET" Version="5.0.0.14392" />
+ <PackageReference Include="Xamarin.Forms" Version="3.1.0.583944" />
</ItemGroup>
<ItemGroup>
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using LibTVRefCommonPortable.Controls.ContextPopup;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Xamarin.Forms.Platform.Tizen;
+using EContextPopup = ElmSharp.ContextPopup;
+using EContextPopupDirection = ElmSharp.ContextPopupDirection;
+using EContextPopupItem = ElmSharp.ContextPopupItem;
+using EIcon = ElmSharp.Icon;
+using XForms = Xamarin.Forms;
+using XFPlatformTizen = Xamarin.Forms.Platform.Tizen;
+
+[assembly: XForms.Dependency(typeof(LibTVRefCommonTizen.Renderers.ContextPopupRenderer))]
+namespace LibTVRefCommonTizen.Renderers
+{
+ public class ContextPopupRenderer : IContextPopup, INotifyPropertyChanged, IDisposable
+ {
+ EContextPopup _popup;
+ IDictionary<ContextPopupItem, EContextPopupItem> _items;
+ bool _isAutoHidingEnabled = true;
+
+ ContextPopupDirectionPriorities _priorities =
+ new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Left, ContextPopupDirection.Right, ContextPopupDirection.Down);
+
+ ContextPopupItem _selectedItem = null;
+
+ bool _isDisposed;
+
+ public ContextPopupRenderer()
+ {
+ _popup = new EContextPopup((FormsApplication.Current as FormsApplication).MainWindow);
+
+ _popup.BackButtonPressed += (s, e) =>
+ {
+ _popup.Dismiss();
+ };
+
+ _popup.Dismissed += (s, e) =>
+ {
+ Dismissed?.Invoke(this, EventArgs.Empty);
+ };
+
+ _items = new Dictionary<ContextPopupItem, EContextPopupItem>();
+ }
+
+ ~ContextPopupRenderer()
+ {
+ Dispose(false);
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public event EventHandler ItemSelected;
+
+ public event EventHandler Dismissed;
+
+ public bool IsAutoHidingEnabled
+ {
+ get
+ {
+ return _isAutoHidingEnabled;
+ }
+
+ set
+ {
+ _isAutoHidingEnabled = value;
+ UpdateIsAutoHidingEnabled();
+ OnPropertyChanged();
+ }
+ }
+
+ public ContextPopupDirectionPriorities DirectionPriorities
+ {
+ get
+ {
+ return _priorities;
+ }
+
+ set
+ {
+ _priorities = value;
+ UpdateDirectionPriorities();
+ OnPropertyChanged();
+ }
+ }
+
+ public ContextPopupItem SelectedItem
+ {
+ get
+ {
+ return _selectedItem;
+ }
+
+ set
+ {
+ _selectedItem = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public void Dismiss()
+ {
+ _popup.Dismiss();
+ }
+
+ public void AddItems(IEnumerable<ContextPopupItem> items)
+ {
+ foreach (var item in items)
+ {
+ item.PropertyChanged += ContextPopupItemPropertyChanged;
+ AddItem(item);
+ }
+ }
+
+ public void RemoveItems(IEnumerable<ContextPopupItem> items)
+ {
+ foreach (var item in items)
+ {
+ item.PropertyChanged -= ContextPopupItemPropertyChanged;
+ if (_items.ContainsKey(item))
+ {
+ var nativeItem = _items[item];
+ nativeItem.Delete();
+ _items.Remove(item);
+ }
+ }
+ }
+
+ public void ClearItems()
+ {
+ foreach (var item in _items.Keys)
+ item.PropertyChanged -= ContextPopupItemPropertyChanged;
+
+ _items.Clear();
+ _popup.Clear();
+ }
+
+ public void Show(XForms.View anchor, int xAnchorOffset, int yAnchorOffset)
+ {
+ var geometry = XFPlatformTizen.Platform.GetRenderer(anchor).NativeView.Geometry;
+ _popup.Move(geometry.X + xAnchorOffset, geometry.Y + yAnchorOffset);
+ _popup.Show();
+ }
+
+ public bool TryGetContextPopupDirection(out ContextPopupDirection direction)
+ {
+ var nativeDirection = _popup.Direction;
+ if (nativeDirection != EContextPopupDirection.Unknown)
+ {
+ direction = (ContextPopupDirection)nativeDirection;
+ return true;
+ }
+ else
+ {
+ direction = default(ContextPopupDirection);
+ return false;
+ }
+ }
+
+ public void UpdateContextPopupItemLabel(ContextPopupItem item)
+ {
+ EContextPopupItem nativeItem = _items[item];
+ nativeItem.SetPartText("default", item.Label);
+ }
+
+ public void UpdateContextPopupItemIcon(ContextPopupItem item)
+ {
+ if (string.IsNullOrEmpty(item.Icon))
+ _items[item]?.SetPartContent("icon", null);
+ else
+ AppendOrModifyItemWithIcon(item);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool isDisposing)
+ {
+ if (_isDisposed)
+ return;
+
+ if (isDisposing)
+ {
+ if (_popup != null)
+ {
+ _popup.Unrealize();
+ _popup = null;
+ }
+ }
+
+ _isDisposed = true;
+ }
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ void ContextPopupItemPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ var item = sender as ContextPopupItem;
+
+ if (e.PropertyName == nameof(ContextPopupItem.Label))
+ {
+ // If the native item already has a label
+ UpdateContextPopupItemLabel(item);
+ }
+ else if (e.PropertyName == nameof(ContextPopupItem.Icon))
+ {
+ // If the native item already has an icon
+ UpdateContextPopupItemIcon(item);
+ }
+ }
+
+ void UpdateDirectionPriorities()
+ {
+ _popup.SetDirectionPriorty(
+ (EContextPopupDirection)_priorities.First,
+ (EContextPopupDirection)_priorities.Second,
+ (EContextPopupDirection)_priorities.Third,
+ (EContextPopupDirection)_priorities.Fourth);
+ }
+
+ void UpdateIsAutoHidingEnabled()
+ {
+ _popup.AutoHide = IsAutoHidingEnabled;
+ }
+
+ void AddItem(ContextPopupItem item)
+ {
+ if (_items.ContainsKey(item))
+ return;
+
+ EContextPopupItem nativeItem;
+ if (string.IsNullOrEmpty(item.Icon))
+ {
+ nativeItem = _popup.Append(item.Label);
+ }
+ else
+ {
+ nativeItem = AppendOrModifyItemWithIcon(item);
+ }
+
+ _items.Add(item, nativeItem);
+
+ nativeItem.Selected += (s, e) =>
+ {
+ SelectedItem = item; // This will invoke SelectedIndexChanged if the index has changed
+ ItemSelected?.Invoke(this, EventArgs.Empty);
+ };
+ }
+
+ EContextPopupItem AppendOrModifyItemWithIcon(ContextPopupItem item)
+ {
+ EContextPopupItem nativeItem = null;
+ EIcon icon = new EIcon(_popup);
+ icon.StandardIconName = item.Icon;
+ if (!string.IsNullOrEmpty(icon.StandardIconName))
+ {
+ if (!_items.ContainsKey(item))
+ nativeItem = _popup.Append(item.Label, icon);
+ else
+ _items[item].SetPartContent("icon", icon);
+ }
+ else
+ {
+ //Not a standard icon
+ XFPlatformTizen.Native.Image iconImage = new XFPlatformTizen.Native.Image(_popup);
+ var task = iconImage.LoadFromImageSourceAsync(item.Icon);
+ if (!_items.ContainsKey(item))
+ nativeItem = _popup.Append(item.Label, iconImage);
+ else
+ _items[item].SetPartContent("icon", iconImage);
+ }
+
+ return nativeItem;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using ElmSharp;
+using LibTVRefCommonPortable.Controls;
+using LibTVRefCommonTizen.Renderers;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+
+[assembly: ExportRenderer(typeof(DropdownList), typeof(DropdownListRenderer))]
+namespace LibTVRefCommonTizen.Renderers
+{
+ public class DropdownListRenderer : ViewRenderer<DropdownList, Hoversel>
+ {
+ class DropdownItem : BindableObject
+ {
+ public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(DropdownItem), default(string));
+
+ public string Text
+ {
+ get { return (string)GetValue(TextProperty); }
+ set { SetValue(TextProperty, value); }
+ }
+
+ public HoverselItem HoverselItem { get; set; }
+ public object Data { get; set; }
+ }
+
+ Dictionary<HoverselItem, DropdownItem> _items = new Dictionary<HoverselItem, DropdownItem>();
+ Dictionary<object, DropdownItem> _objectMap = new Dictionary<object, DropdownItem>();
+ object _selectedItem = null;
+
+ protected override void OnElementChanged(ElementChangedEventArgs<DropdownList> e)
+ {
+ if (Control == null)
+ {
+ var dropdownList = new Hoversel((FormsApplication.Current as FormsApplication).MainWindow);
+ SetNativeControl(dropdownList);
+ Control.ItemSelected += OnHoverselItemSelected;
+ Control.Dismissed += OnDismissed;
+ Control.Expanded += OnExpanded;
+ }
+ if (e.OldElement != null)
+ {
+ e.OldElement.ExpandChangeRequested -= OnExpandChangeRequested;
+ e.OldElement.CollectionChanged -= OnCollectionChanged;
+ ClearItems();
+ }
+ if (e.NewElement != null)
+ {
+ e.NewElement.ExpandChangeRequested += OnExpandChangeRequested;
+ e.NewElement.CollectionChanged += OnCollectionChanged;
+ Control.HoverParent = (FormsApplication.Current as FormsApplication).MainWindow;
+
+ AddItems(e.NewElement.ItemsSource);
+ UpdateIsExpanded();
+ UpdateSelectedItem();
+ }
+ base.OnElementChanged(e);
+ }
+
+ void OnHoverselItemSelected(object sender, HoverselItemEventArgs e)
+ {
+ Element.SelectedItem = GetItem(e.Item)?.Data;
+ }
+
+ void OnExpanded(object sender, EventArgs e)
+ {
+ Element?.SetValue(DropdownList.IsExpandedPropertyKey, true);
+ }
+
+ void OnDismissed(object sender, EventArgs e)
+ {
+ Element?.SetValue(DropdownList.IsExpandedPropertyKey, false);
+ }
+
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == DropdownList.IsExpandedProperty.PropertyName)
+ {
+ UpdateIsExpanded();
+ }
+ else if (e.PropertyName == DropdownList.DisplayMemberPathProperty.PropertyName)
+ {
+ UpdateDisplayMemberPath();
+ }
+ else if (e.PropertyName == DropdownList.SelectedItemProperty.PropertyName)
+ {
+ UpdateSelectedItem();
+ }
+ else if (e.PropertyName == DropdownList.ItemsSourceProperty.PropertyName)
+ {
+ UpdateItemSource();
+ }
+ base.OnElementPropertyChanged(sender, e);
+ }
+
+ void UpdateItemSource()
+ {
+ ClearItems();
+ AddItems(Element.ItemsSource);
+ }
+
+ void UpdateIsExpanded()
+ {
+ if (Element.IsExpanded)
+ {
+ Control.HoverBegin();
+ }
+ else
+ {
+ Control.HoverEnd();
+ }
+ }
+
+ void UpdateSelectedItem()
+ {
+ _selectedItem = Element.SelectedItem;
+ DropdownItem item = GetItem(Element.SelectedItem);
+ if (item == null)
+ {
+ Element.SelectedItem = null;
+ Control.Text = string.Empty;
+ }
+ else
+ {
+ Control.Text = item.Text;
+ }
+ }
+
+ void OnExpandChangeRequested(object sender, DropdownList.ExpandRequestArgs e)
+ {
+ if (e.IsExpand)
+ {
+ Control.HoverBegin();
+ }
+ else
+ {
+ Control.HoverEnd();
+ }
+ }
+
+ void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ if (e.NewItems != null)
+ {
+ AddItems(e.NewItems);
+ }
+ if (e.OldItems != null)
+ {
+ RemoveItems(e.OldItems);
+ }
+ if (e.Action == NotifyCollectionChangedAction.Reset)
+ {
+ ClearItems();
+ }
+ }
+
+ void AddItems(IEnumerable items)
+ {
+ foreach (object item in items)
+ {
+ DropdownItem dropdownItem = new DropdownItem()
+ {
+ Data = item,
+ };
+ if (!string.IsNullOrEmpty(Element.DisplayMemberPath))
+ {
+ dropdownItem.SetBinding(DropdownItem.TextProperty, new Binding(Element.DisplayMemberPath));
+ }
+ else
+ {
+ dropdownItem.Text = item.ToString();
+ }
+ dropdownItem.BindingContext = item;
+ dropdownItem.HoverselItem = Control.AddItem(dropdownItem.Text);
+ dropdownItem.PropertyChanged += OnDropdownItemTextChanged;
+ _items[dropdownItem.HoverselItem] = dropdownItem;
+ _objectMap[item] = dropdownItem;
+ }
+ }
+
+ void OnDropdownItemTextChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == DropdownItem.TextProperty.PropertyName)
+ {
+ DropdownItem item = (DropdownItem)sender;
+ item.HoverselItem?.SetPartText("default", item.Text);
+ if (_selectedItem == item.Data)
+ {
+ Control.Text = item.Text;
+ }
+ }
+ }
+
+ void UpdateDisplayMemberPath()
+ {
+ foreach (var item in _items.Values)
+ {
+ if (!string.IsNullOrEmpty(Element.DisplayMemberPath))
+ {
+ item.SetBinding(DropdownItem.TextProperty, new Binding(Element.DisplayMemberPath));
+ }
+ else
+ {
+ item.Text = item.Data.ToString();
+ }
+ }
+ UpdateSelectedItem();
+ }
+
+ void RemoveItems(IEnumerable items)
+ {
+ foreach (object item in items)
+ {
+ var dropdownItem = GetItem(item);
+ if (Element.SelectedItem == dropdownItem.Data)
+ {
+ Element.SelectedItem = null;
+ }
+ dropdownItem.PropertyChanged -= OnDropdownItemTextChanged;
+ _items.Remove(dropdownItem.HoverselItem);
+ _objectMap.Remove(item);
+ dropdownItem.HoverselItem.Delete();
+ }
+ }
+
+ void ClearItems()
+ {
+ Control.Clear();
+ _items.Clear();
+ _objectMap.Clear();
+
+ Element.SelectedItem = null;
+ }
+
+ DropdownItem GetItem(object obj)
+ {
+ if (obj == null)
+ return null;
+ DropdownItem item = null;
+ _objectMap.TryGetValue(obj, out item);
+ return item;
+ }
+
+ DropdownItem GetItem(HoverselItem selItem)
+ {
+ if (selItem == null)
+ return null;
+ DropdownItem item = null;
+ _items.TryGetValue(selItem, out item);
+ return item;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+namespace LibTVRefCommonTizen.Tizen.Renderers
+{
+ public static class RenderersInitializer
+ {
+ public static bool IsInitialized { get; private set; }
+
+ public static void Initialize()
+ {
+ if(IsInitialized)
+ {
+ return;
+ }
+
+ IsInitialized = true;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using LibTVRefCommonPortable.Controls.Toast;
+using LibTVRefCommonTizen.Renderers;
+using System;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+using EPopup = ElmSharp.Popup;
+
+[assembly: Dependency(typeof(ToastRenderer))]
+
+namespace LibTVRefCommonTizen.Renderers
+{
+ public class ToastRenderer : IToast, IDisposable
+ {
+ static readonly string DefaultStyle = "toast";
+ static readonly string DefaultPart = "default";
+
+ int _duration = 3000;
+ string _text = string.Empty;
+ EPopup _control = null;
+ bool _isDisposed = false;
+
+ public int Duration
+ {
+ get
+ {
+ return _duration;
+ }
+ set
+ {
+ _duration = value;
+ UpdateDuration();
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ return _text;
+ }
+ set
+ {
+ _text = value;
+ UpdateText();
+ }
+ }
+
+ public ToastRenderer()
+ {
+ _control = new EPopup((FormsApplication.Current as FormsApplication).MainWindow)
+ {
+ Style = DefaultStyle,
+ AllowEvents = true,
+ };
+
+ UpdateText();
+ UpdateDuration();
+ }
+
+ ~ToastRenderer()
+ {
+ Dispose(false);
+ }
+
+ public void Show()
+ {
+ _control.Show();
+ }
+
+ public void Dismiss()
+ {
+ _control.Dismiss();
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool isDisposing)
+ {
+ if (_isDisposed)
+ return;
+
+ if (isDisposing)
+ {
+ if (_control != null)
+ {
+ _control.Unrealize();
+ _control = null;
+ }
+ }
+
+ _isDisposed = true;
+ }
+
+ void UpdateDuration()
+ {
+ _control.Timeout = Duration / 1000.0;
+ }
+
+ void UpdateText()
+ {
+ _control.SetPartText(DefaultPart, Text);
+ }
+ }
+}
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
- "signature": "2a93253ff39d191d9ba22d2151167c179fe82d97"
+ "signature": "e90becaf136ef5f8faf0062bd3b7df677510d5f2"
},
"compilationOptions": {},
"targets": {
"LibCommon.Tizen/1.0.0": {
"dependencies": {
"LibCommon.Shared": "1.0.0",
- "NETStandard.Library": "2.0.0",
- "Tizen.NET": "4.0.0-preview1-00143",
- "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005",
+ "NETStandard.Library": "2.0.3",
+ "Tizen.NET": "4.0.0",
+ "Tizen.Xamarin.Forms.Extension": "2.4.0-v00013",
"Xamarin.Forms": "2.4.0.266-pre1",
"Xamarin.Forms.Platform.Tizen": "2.4.0-r266-006"
},
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
- "NETStandard.Library/2.0.0": {
+ "NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
- "Tizen.NET/4.0.0-preview1-00143": {
+ "Tizen.NET/4.0.0": {
"runtime": {
- "lib/netstandard1.6/ElmSharp.Wearable.dll": {},
- "lib/netstandard1.6/ElmSharp.dll": {},
- "lib/netstandard1.6/Tizen.Account.AccountManager.dll": {},
- "lib/netstandard1.6/Tizen.Account.FidoClient.dll": {},
- "lib/netstandard1.6/Tizen.Account.OAuth2.dll": {},
- "lib/netstandard1.6/Tizen.Account.SyncManager.dll": {},
- "lib/netstandard1.6/Tizen.Applications.Alarm.dll": {},
- "lib/netstandard1.6/Tizen.Applications.AttachPanel.dll": {},
- "lib/netstandard1.6/Tizen.Applications.Badge.dll": {},
- "lib/netstandard1.6/Tizen.Applications.Common.dll": {},
- "lib/netstandard1.6/Tizen.Applications.DataControl.dll": {},
- "lib/netstandard1.6/Tizen.Applications.MessagePort.dll": {},
- "lib/netstandard1.6/Tizen.Applications.Notification.dll": {},
- "lib/netstandard1.6/Tizen.Applications.NotificationEventListener.dll": {},
- "lib/netstandard1.6/Tizen.Applications.PackageManager.dll": {},
- "lib/netstandard1.6/Tizen.Applications.Preference.dll": {},
- "lib/netstandard1.6/Tizen.Applications.RemoteView.dll": {},
- "lib/netstandard1.6/Tizen.Applications.Service.dll": {},
- "lib/netstandard1.6/Tizen.Applications.ToastMessage.dll": {},
- "lib/netstandard1.6/Tizen.Applications.UI.dll": {},
- "lib/netstandard1.6/Tizen.Applications.WatchApplication.dll": {},
- "lib/netstandard1.6/Tizen.Applications.WidgetApplication.dll": {},
- "lib/netstandard1.6/Tizen.Applications.WidgetControl.dll": {},
- "lib/netstandard1.6/Tizen.Content.Download.dll": {},
- "lib/netstandard1.6/Tizen.Content.MediaContent.dll": {},
- "lib/netstandard1.6/Tizen.Content.MimeType.dll": {},
- "lib/netstandard1.6/Tizen.Context.dll": {},
- "lib/netstandard1.6/Tizen.Location.Geofence.dll": {},
- "lib/netstandard1.6/Tizen.Location.dll": {},
- "lib/netstandard1.6/Tizen.Log.dll": {},
- "lib/netstandard1.6/Tizen.Maps.dll": {},
- "lib/netstandard1.6/Tizen.Messaging.Push.dll": {},
- "lib/netstandard1.6/Tizen.Messaging.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.AudioIO.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Camera.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.MediaCodec.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.MediaPlayer.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Metadata.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Radio.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Recorder.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Remoting.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.StreamRecorder.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Util.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.Vision.dll": {},
- "lib/netstandard1.6/Tizen.Multimedia.dll": {},
- "lib/netstandard1.6/Tizen.NUI.dll": {},
- "lib/netstandard1.6/Tizen.Network.Bluetooth.dll": {},
- "lib/netstandard1.6/Tizen.Network.Connection.dll": {},
- "lib/netstandard1.6/Tizen.Network.IoTConnectivity.dll": {},
- "lib/netstandard1.6/Tizen.Network.Nfc.dll": {},
- "lib/netstandard1.6/Tizen.Network.Nsd.dll": {},
- "lib/netstandard1.6/Tizen.Network.Smartcard.dll": {},
- "lib/netstandard1.6/Tizen.Network.WiFi.dll": {},
- "lib/netstandard1.6/Tizen.Network.WiFiDirect.dll": {},
- "lib/netstandard1.6/Tizen.PhonenumberUtils.dll": {},
- "lib/netstandard1.6/Tizen.Pims.Calendar.dll": {},
- "lib/netstandard1.6/Tizen.Pims.Contacts.dll": {},
- "lib/netstandard1.6/Tizen.Security.SecureRepository.dll": {},
- "lib/netstandard1.6/Tizen.Security.TEEC.dll": {},
- "lib/netstandard1.6/Tizen.Security.dll": {},
- "lib/netstandard1.6/Tizen.Sensor.dll": {},
- "lib/netstandard1.6/Tizen.System.Feedback.dll": {},
- "lib/netstandard1.6/Tizen.System.Information.dll": {},
- "lib/netstandard1.6/Tizen.System.MediaKey.dll": {},
- "lib/netstandard1.6/Tizen.System.PlatformConfig.dll": {},
- "lib/netstandard1.6/Tizen.System.Storage.dll": {},
- "lib/netstandard1.6/Tizen.System.SystemSettings.dll": {},
- "lib/netstandard1.6/Tizen.System.dll": {},
- "lib/netstandard1.6/Tizen.Telephony.dll": {},
- "lib/netstandard1.6/Tizen.Tracer.dll": {},
- "lib/netstandard1.6/Tizen.Uix.InputMethod.dll": {},
- "lib/netstandard1.6/Tizen.Uix.InputMethodManager.dll": {},
- "lib/netstandard1.6/Tizen.Uix.Stt.dll": {},
- "lib/netstandard1.6/Tizen.Uix.Tts.dll": {},
- "lib/netstandard1.6/Tizen.Uix.VoiceControl.dll": {},
- "lib/netstandard1.6/Tizen.WebView.dll": {},
- "lib/netstandard1.6/Tizen.dll": {}
+ "lib/netstandard2.0/ElmSharp.Wearable.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/ElmSharp.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Account.AccountManager.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Account.FidoClient.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Account.OAuth2.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Account.SyncManager.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Alarm.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.AttachPanel.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Badge.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Common.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.DataControl.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.MessagePort.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Notification.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.NotificationEventListener.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.PackageManager.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Preference.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.RemoteView.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Service.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.Shortcut.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.ToastMessage.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.UI.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.WatchApplication.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.WidgetApplication.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Applications.WidgetControl.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Content.Download.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Content.MediaContent.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Content.MimeType.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Context.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Location.Geofence.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Location.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Log.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Maps.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Messaging.Push.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Messaging.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.AudioIO.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Camera.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.MediaCodec.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.MediaPlayer.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Metadata.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Radio.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Recorder.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Remoting.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.StreamRecorder.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Util.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.Vision.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Multimedia.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.NUI.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.Bluetooth.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.Connection.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.IoTConnectivity.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.Nfc.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.Nsd.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.Smartcard.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.WiFi.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Network.WiFiDirect.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.PhonenumberUtils.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Pims.Calendar.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Pims.Contacts.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Security.PrivacyPrivilegeManager.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Security.SecureRepository.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Security.TEEC.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Security.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Sensor.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.Feedback.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.Information.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.MediaKey.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.PlatformConfig.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.Storage.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.SystemSettings.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.Usb.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.System.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Telephony.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Tracer.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.InputMethod.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.InputMethodManager.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.Stt.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.SttEngine.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.Tts.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.TtsEngine.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.Uix.VoiceControl.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.WebView.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ },
+ "lib/netstandard2.0/Tizen.dll": {
+ "assemblyVersion": "4.0.0.0",
+ "fileVersion": "4.0.0.0"
+ }
}
},
- "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": {
+ "Tizen.Xamarin.Forms.Extension/2.4.0-v00013": {
"dependencies": {
"Xamarin.Forms": "2.4.0.266-pre1"
},
"runtime": {
- "lib/netstandard1.0/Tizen.Xamarin.Forms.Extension.dll": {}
+ "lib/netstandard1.0/Tizen.Xamarin.Forms.Extension.dll": {
+ "assemblyVersion": "0.0.1.0",
+ "fileVersion": "0.0.1.0"
+ }
}
},
"Xamarin.Forms/2.4.0.266-pre1": {
"runtime": {
- "lib/netstandard1.0/Xamarin.Forms.Core.dll": {},
- "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {},
- "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {}
+ "lib/netstandard1.0/Xamarin.Forms.Core.dll": {
+ "assemblyVersion": "2.0.0.0",
+ "fileVersion": "2.0.0.0"
+ },
+ "lib/netstandard1.0/Xamarin.Forms.Platform.dll": {
+ "assemblyVersion": "1.0.0.0",
+ "fileVersion": "1.0.0.0"
+ },
+ "lib/netstandard1.0/Xamarin.Forms.Xaml.dll": {
+ "assemblyVersion": "2.0.0.0",
+ "fileVersion": "2.0.0.0"
+ }
}
},
"Xamarin.Forms.Platform.Tizen/2.4.0-r266-006": {
"dependencies": {
- "Tizen.NET": "4.0.0-preview1-00143",
+ "Tizen.NET": "4.0.0",
"Xamarin.Forms": "2.4.0.266-pre1"
},
"runtime": {
- "lib/netstandard1.6/Xamarin.Forms.Platform.Tizen.dll": {}
+ "lib/netstandard1.6/Xamarin.Forms.Platform.Tizen.dll": {
+ "assemblyVersion": "0.0.0.0",
+ "fileVersion": "0.0.0.0"
+ }
}
},
"LibCommon.Shared/1.0.0": {
"dependencies": {
- "Tizen.Xamarin.Forms.Extension": "2.4.0-v00005",
+ "Tizen.Xamarin.Forms.Extension": "2.4.0-v00013",
"Xamarin.Forms": "2.4.0.266-pre1"
},
"runtime": {
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
+ "sha512": "sha512-bLpT1f/SFlO1CzqXG12KnJzpZs6lv24uX2Rzi4Fmm0noJpNlnWRVryuO3yK18Ca04t/YHcO1e1Z0WDfjseqNzw==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
- "NETStandard.Library/2.0.0": {
+ "NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-7jnbRU+L08FXKMxqUflxEXtVymWvNOrS8yHgu9s6EM8Anr6T/wIX4nZ08j/u3Asz+tCufp3YVwFSEvFTPYmBPA==",
- "path": "netstandard.library/2.0.0",
- "hashPath": "netstandard.library.2.0.0.nupkg.sha512"
+ "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
+ "path": "netstandard.library/2.0.3",
+ "hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
- "Tizen.NET/4.0.0-preview1-00143": {
+ "Tizen.NET/4.0.0": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-woW6D9FsWZD2lJRwbND2hzMIi9l7QYwUqfpCxrMT3+Mh3+8UdFM86skDdw3mAgpLIqfC1plUfbISksQ9G2Gcgg==",
- "path": "tizen.net/4.0.0-preview1-00143",
- "hashPath": "tizen.net.4.0.0-preview1-00143.nupkg.sha512"
+ "sha512": "sha512-e/q/gwwzrcR6LRsQiZbpKYN+GJsiA7/lh6p8ztANDoJLnIlKPmiNsBXxm6Tt8yHzwMywmAXBwyp4mpLCRG0J+A==",
+ "path": "tizen.net/4.0.0",
+ "hashPath": "tizen.net.4.0.0.nupkg.sha512"
},
- "Tizen.Xamarin.Forms.Extension/2.4.0-v00005": {
+ "Tizen.Xamarin.Forms.Extension/2.4.0-v00013": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-MKUamVt5XloZ/JziyOXLdbahn7T0LDQDJGUt3ynt0iSia4aLpZLOua6/iypBhnC79FgMaNfUA7APjVfjh3NLTg==",
- "path": "tizen.xamarin.forms.extension/2.4.0-v00005",
- "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00005.nupkg.sha512"
+ "sha512": "sha512-sOfaxQdXEYrMPMSmbn8/0Y4Q/K+1mnaQ4k2CM275b2C+aVhZOAQEqRVq7xCLZyNsCeZLLKPTbVhpeIirluDIOw==",
+ "path": "tizen.xamarin.forms.extension/2.4.0-v00013",
+ "hashPath": "tizen.xamarin.forms.extension.2.4.0-v00013.nupkg.sha512"
},
"Xamarin.Forms/2.4.0.266-pre1": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-pMu+b01vdH1ul5EJo1opQjEcwisWT35DdZO6EuR9HNKfY1dWyKmAlWgRdGUtjtdbhjOAtCOQUxI7F3x4hvV8KA==",
+ "sha512": "sha512-kCftdF7OBbO/SmsIyG/7SjKWoxQZCqxC+MSEbtDc4VWmYcuZsDCUK4pXWRpvwUp5MGdfAec87+AQ7yrlEvBMMQ==",
"path": "xamarin.forms/2.4.0.266-pre1",
"hashPath": "xamarin.forms.2.4.0.266-pre1.nupkg.sha512"
},
<!-- Include Nuget Package for Tizen Project building -->
<ItemGroup>
- <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00224" />
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.0-pre2" />
- <PackageReference Include="Tizen.Xamarin.Forms.Extension" Version="2.4.0-v00013" />
- <PackageReference Include="Xamarin.Forms" Version="2.4.0-r266-006" />
- <PackageReference Include="Xamarin.Forms.Platform.Tizen" Version="2.4.0-r269-002" />
+ <PackageReference Include="Tizen.NET" Version="5.0.0.14392" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
+ <PackageReference Include="Xamarin.Forms" Version="3.1.0.583944" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\LibCommon.Shared\LibCommon.Shared.csproj" />
using LibTVRefCommonPortable.Utils;
using LibTVRefCommonTizen.Ports;
+using LibTVRefCommonTizen.Tizen.Renderers;
using Tizen.Applications;
-using Tizen.Xamarin.Forms.Extension.Renderer;
namespace TVApps.TizenTV
{
PackageManagerPort.RegisterCallbacks(notification);
MainWindow.Alpha = true;
-
KeyUpEvent.On += KeyUpListener;
}
Xamarin.Forms.DependencyService.Register<ApplicationManagerPort>();
Xamarin.Forms.DependencyService.Register<FileSystemPort>();
Xamarin.Forms.DependencyService.Register<SystemSettingsPort>();
-
+ RenderersInitializer.Initialize();
Xamarin.Forms.Platform.Tizen.Forms.Init(instance);
- TizenFormsExtension.Init();
instance.Run(args);
}
using System.ComponentModel;
using System.Windows.Input;
using Xamarin.Forms;
-using Tizen.Xamarin.Forms.Extension;
namespace TVApps.Controls
{
+ using LibTVRefCommonPortable.Controls.ContextPopup;
using LibTVRefCommonPortable.DataModels;
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
using Tizen = Xamarin.Forms.PlatformConfiguration.Tizen;
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>tizen40</TargetFramework>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Tizen.Xamarin.Forms.Extension" Version="2.4.0-v00013" />
- <PackageReference Include="Xamarin.Forms" Version="2.4.0-r266-006" />
+ <PackageReference Include="Xamarin.Forms" Version="3.1.0.583944" />
</ItemGroup>
<ItemGroup>
*/
using Xamarin.Forms;
-using Tizen.Xamarin.Forms.Extension;
using LibTVRefCommonPortable.Utils;
using System.Windows.Input;
using System;
using System.Collections.Generic;
using TVApps.Controls;
+using LibTVRefCommonPortable.Controls;
+using LibTVRefCommonPortable.Controls.ContextPopup;
namespace TVApps.Views
{
using System.Windows.Input;
using System.Collections.Generic;
using System.Linq;
-using Tizen.Xamarin.Forms.Extension;
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
+using LibTVRefCommonPortable.Controls;
+using LibTVRefCommonPortable.Controls.Toast;
namespace TVApps.Views
{
- using System;
using Tizen = Xamarin.Forms.PlatformConfiguration.Tizen;
/// <summary>
/// A custom view for displaying main page of TV Apps
<PropertyGroup>
<NoWarn>$(NoWarn);NU1605</NoWarn>
+ <SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<!-- Include Nuget Package for Tizen Project building -->
<ItemGroup>
- <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00224" />
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.0-pre2" />
- <PackageReference Include="Tizen.Xamarin.Forms.Extension" Version="2.4.0-v00013" />
- <PackageReference Include="Xamarin.Forms" Version="2.4.0-r266-006" />
- <PackageReference Include="Xamarin.Forms.Platform.Tizen" Version="2.4.0-r269-002" />
+ <PackageReference Include="Tizen.NET" Version="5.0.0.14392" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
+ <PackageReference Include="Xamarin.Forms" Version="3.1.0.583944" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\LibCommon.Shared\LibCommon.Shared.csproj" />
using Tizen.Applications;
using LibTVRefCommonPortable.Utils;
using LibTVRefCommonTizen.Ports;
-using Tizen.Xamarin.Forms.Extension.Renderer;
using ElmSharp;
-using System;
+using LibTVRefCommonTizen.Tizen.Renderers;
namespace TVHome.TizenTV
{
global::Xamarin.Forms.DependencyService.Register<FileSystemPort>();
global::Xamarin.Forms.DependencyService.Register<WindowPort>();
global::Xamarin.Forms.DependencyService.Register<SystemSettingsPort>();
- TizenFormsExtension.Init();
+
+ RenderersInitializer.Initialize();
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
app.Run(args);
}
<icon>xahome.png</icon>
<label>Home</label>
</ui-application>
- <ui-application appid="org.tizen.xaapps" exec="TVApps.Tizen.TV.dll" multiple="false" nodisplay="true" taskmanage="false" splash-screen-display="false" type="dotnet" launch_mode="single">
- <icon>xaapps.png</icon>
- <label>Apps</label>
- </ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/bluetooth</privilege>
* limitations under the License.
*/
+using LibTVRefCommonPortable.Controls.ContextPopup;
using LibTVRefCommonPortable.Utils;
using System;
using System.ComponentModel;
using System.Windows.Input;
-using Tizen.Xamarin.Forms.Extension;
using Xamarin.Forms;
namespace TVHome.Controls
*/
using System;
+using LibTVRefCommonPortable.Controls.ContextPopup;
using LibTVRefCommonPortable.Utils;
using Xamarin.Forms;
-using Tizen.Xamarin.Forms.Extension;
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
namespace TVHome.Controls
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>tizen40</TargetFramework>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Tizen.Xamarin.Forms.Extension" Version="2.4.0-v00013" />
- <PackageReference Include="Xamarin.Forms" Version="2.4.0-r266-006" />
+ <PackageReference Include="Xamarin.Forms" Version="3.1.0.583944" />
</ItemGroup>
<ItemGroup>