상속: MonoBehaviour
예제 #1
0
        private void LoadMainMenuItems()
        {
            MainMenuNavigator.Loaded += (s, e) =>
            {
                MainMenuNavigator.Menu.HeaderText            = "Main Menu";
                MainMenuNavigator.Menu.CollapsedWidth        = 50.0;
                MainMenuNavigator.Menu.ExpandedWidth         = 200.0;
                MainMenuNavigator.Menu.MenuSelectionChanged += OnMenuSelectionChanged;
                MainMenuNavigator.Menu.SelectedIndex         = 0;
                MainMenuNavigator.Menu.Expand();

                AddChild("Home", new HomeConnector("Home", this, new HomeControl()));
                AddChild("Work Time", new WorkTimeConnector("Work Time", this, new WorkTimeControl()));
                AddChild("Accounts", new AccountsConnector("Accounts", this, new AccountsControl()));
                AddChild("Documents", new DocumentsConnector("Documents", this, new DocumentsControl()));
                AddChild("Admin", new AdminConnector("Admin", this, new AdminControl()));
                AddChild("Management", new ManagementConnector("Management", this, new ManagementControl()));
                AddChild("Settings", new SettingsConnector("Settings", this, new SettingsControl()));
                AddChild("Help", new HelpConnector("Help", this, new HelpControl()));

                foreach (var childTag in this.Children)
                {
                    var childConnector = this.Child(childTag);
                    var control        = childConnector.Ui;
                    var tag            = childConnector.Tag;
                    var imageStr       = tag.Replace(" ", "");
                    var item           = new SelectableItem(childTag, control, "./Images/MainMenu/" + imageStr + "_white.png")
                    {
                        IconHeight = 35, IconWidth = 35, ItemHeight = 50
                    };
                    MainMenuNavigator.Menu.AddMenuItem(item);
                }
            };
        }
        private static void EnumTypePropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var obj   = sender as FilterEnumSelectionBox;
            var list  = (Type)e.NewValue;
            var items = new List <SelectableItem <SelectionObject> >();

            if (obj.ItemsList.HasItems())
            {
                foreach (var item in obj.ItemsList)
                {
                    item.PropertyChanged -= obj.NewItem_PropertyChanged;
                }
            }

            foreach (Enum en in list.GetEnumValues())
            {
                var newItem = new SelectableItem <SelectionObject>(new SelectionObject(en));
                if (obj.FilterProperties != null)
                {
                    newItem.Selected = obj.FilterProperties.Values?.Contains(newItem.Item.Value) == true;
                }

                newItem.PropertyChanged += obj.NewItem_PropertyChanged;
                items.Add(newItem);
            }

            obj.ItemsList = items;
        }
예제 #3
0
        //public Options(string tab)
        //{
        //    InitializeComponent();

        //    SetupTabs();
        //    LoadTab(tab);
        //}

        #region Tab bar
        void SetupTabs()
        {
            selTabs.AddItem(CreateTab("General"));
            //selTabs.AddItem(CreateTab("Saving"));
            selTabs.AddItem(CreateTab("Interface"));
            selTabs.AddItem(CreateTab("JSON Editor"));
            selTabs.AddItem(CreateTab("Feedback"));
            selTabs.AddItem(CreateTab("Advanced"));

            SelectableItem CreateTab(string name, ImageSource?image = null)
            {
                SelectableItem si = new SelectableItem
                {
                    Height = 36,
                    Text   = name,
                    Indent = 6
                };

                if (image == null)
                {
                    si.ShowImage = false;
                }
                else
                {
                    si.ImageSource = image;
                    si.ShowImage   = true;
                }

                si.Click += tabItem_Click;
                return(si);
            }
        }
예제 #4
0
 public void Update()
 {
     if (GameManager.Instance.ActiveGame &&
         !GameManager.Instance.eventManager.eventActive &&
         Input.GetButtonDown("MouseLeftClick"))
     {
         SelectableItem previousSelected = selectedItem;
         if (selectedItem)
         {
             selectedItem.Selected = false;
             selectedItem.OnUnselect();
             selectedItem = null;
         }
         if (hoveringItem)
         {
             if (previousSelected != hoveringItem)
             {
                 hoveringItem.OnSelect();
             }
             hoveringItem.Selected = true;
             hoveringItem.OnClick();
             selectedItem = hoveringItem;
         }
     }
 }
 public Nationality()
 {
     // use proper class instead of SelectableItem
     SelectedItem = new SelectableItem {
         Value = null
     };
 }
        private void LoadMenuItems(HamburgerNavigator n)
        {
            var strs = new Dictionary <string, UserControl>()
            {
                { "Home", new HomeControl() },
                { "Attendance", new AttendanceControl() },
                { "Leaves", new LeavesControl() },
                { "Documents", new DocumentsControl() },
                { "Admin", new AdminControl() },
                { "Settings", new SettingsControl() },
                { "Help", new HelpControl() },
            };

            foreach (var k in strs.Keys)
            {
                var control = strs[k];
                var item    = new SelectableItem(k, control, "./Images/Generic/" + k + "_white.png")
                {
                    IconHeight = 35,
                    IconWidth  = 35,
                    ItemHeight = 50
                };
                n.Menu.AddMenuItem(item);
            }
        }
예제 #7
0
 public virtual void addItem(SelectableItem item)
 {
     item.listIndex	= _itemAry.Count;
     item.parentList	= this;
     _itemAry.Add(item);
     addChild(item);
 }
예제 #8
0
 public void addItemAt(SelectableItem item,int index)
 {
     item.listIndex	= index;
     item.parentList	= this;
     _itemAry.Insert(index,item);
     addChild(item);
 }
예제 #9
0
        private void LoadMenuItems()
        {
            Navigator.Loaded += (s, e) =>
            {
                Navigator.Menu.HeaderText            = "Work Time";
                Navigator.Menu.CollapsedWidth        = 50.0;
                Navigator.Menu.ExpandedWidth         = 200.0;
                Navigator.Menu.MenuSelectionChanged += OnMenuSelectionChanged;
                Navigator.Menu.SelectedIndex         = 0;
                Navigator.Menu.Expand();

                AddChild("Attendance", new AttendanceConnector("Attendance", this, new AttendanceControl()));
                AddChild("Regularization", new RegularizationConnector("Regularization", this, new RegularizationControl()));
                AddChild("Leaves", new LeavesConnector("Leaves", this, new LeavesControl()));

                foreach (var childTag in Children)
                {
                    var childConnector = Child(childTag);
                    var control        = childConnector.Ui;
                    var tag            = childConnector.Tag;
                    var imageStr       = tag.Replace(" ", "");
                    var item           = new SelectableItem(childTag, control, "./Images/WorkTime/" + imageStr + "_white.png")
                    {
                        IconHeight = 35, IconWidth = 35, ItemHeight = 50
                    };
                    Navigator.Menu.AddMenuItem(item);
                }
            };
        }
예제 #10
0
    void SpawnShipWeaponIcon()
    {
        Canvas canvas = GameManager.ins.GetCopyOfCanvas("ShipWeaponIcons");

        float y = 0;

        shipWeaponSelectables = new ShipWeaponSelectableIcon[boss.AttackTypes.Length];
        for (int i = 0; i < boss.AttackTypes.Length; i++)
        {
            Boss.AttackType _type = boss.AttackTypes[i];

            RectTransform newIconT = Instantiate(iconPrefab, canvas.transform).GetComponent <RectTransform>();
            Vector3       pos      = newIconT.anchoredPosition;
            pos.y = y;
            newIconT.anchoredPosition = pos;
            y += 80;

            newIconT.GetComponentInChildren <TextMeshProUGUI>().text = (boss.AttackTypes.Length - i).ToString();
            newIconT.GetChild(0).GetComponent <Image>().sprite       = Resources.Load <Sprite>("Image/Icon/" + _type.ToString());

            ShipWeaponSelectableIcon current = shipWeaponSelectables[i] = newIconT.GetComponent <ShipWeaponSelectableIcon>();
            current.Setup(this, _type);

            if (i > 0)
            {
                shipWeaponSelectables[i - 1].NavTop = shipWeaponSelectables[i];
                shipWeaponSelectables[i].NavBottom  = shipWeaponSelectables[i - 1];
            }
        }

        selected          = shipWeaponSelectables[shipWeaponSelectables.Length - 1];
        selected.Selected = true;
    }
예제 #11
0
파일: MainMenu.cs 프로젝트: meekr/Haima
 public override void addItem(SelectableItem item)
 {
     base.addItem(item);
     item.x	= _offsetX + item.listIndex * _iconWidth;
     item.addEventListner(MouseEvent.MOUSE_DOWN, itemMouseDownHandler);
     item.addEventListner(GuiEvent.SELECT, selectHandler);
     item.addEventListner(GuiEvent.UNSELECT, unselectHandler);
 }
예제 #12
0
 public void ActiveWeapon(SelectableItem selectable, Boss.AttackType type)
 {
     if (!selectable.Disabled && !selectable.Active && boss.Idling)
     {
         selectable.Active = true;
         boss.NewAttack(type);
     }
 }
예제 #13
0
    void ListenTouchMouse()
    {
        Vector3 temp = Input.mousePosition;

        temp.z = Mathf.Abs(Camera.main.transform.position.z);    // Set this to be the distance you want the object to be placed in front of the camera.
        Vector3 destination = Camera.main.ScreenToWorldPoint(temp);

        Vector3 direction = destination - cam.transform.position;

        Debug.DrawRay(Camera.main.transform.position, direction, Color.blue);
        Ray ray = new Ray(Camera.main.transform.position, direction);


        RaycastHit rhit = new RaycastHit();

        Physics.Raycast(ray, out rhit);
        if (rhit.collider)
        {
            SelectableItem hoveredOverItem = rhit.collider.gameObject.GetComponent <SelectableItem>();
            if (hoveredOverItem)
            {
                if (debugSelectionManager.LogSelectionObjectName)
                {
                    Debug.Log(rhit.collider.gameObject.name);
                }

                hoveredOverItem.HoveringItem();

                foreach (SelectableItem s in selectableItems)
                {
                    if (s != hoveredOverItem)
                    {
                        s.LeaveHovering();
                    }
                }

                if (Input.GetMouseButtonUp(0) || Input.GetKeyUp(KeyCode.Return))
                {
                    hoveredOverItem.SelectedItem();

                    foreach (SelectableItem s in selectableItems)
                    {
                        if (s != hoveredOverItem && hoveredOverItem.SelectionGroup == s.SelectionGroup)
                        {
                            s.isSelected = Selected.No;
                        }
                    }

                    ManageSelection(hoveredOverItem);

                    if (!hoveredOverItem.staySelected)
                    {
                        hoveredOverItem.isSelected = Selected.No;
                    }
                }
            }
        }
    }
        public async Task <bool> UpdateItemAsync(SelectableItem <City> item)
        {
            var _item = items.Where((SelectableItem <City> arg) => arg.Data.Id == item.Data.Id).FirstOrDefault();

            items.Remove(_item);
            items.Add(item);

            return(await Task.FromResult(true));
        }
예제 #15
0
        public AddNewCityPage()
        {
            InitializeComponent();

            OfferedCity = new SelectableItem <City>(new City(Guid.NewGuid().ToString(), "City name", "City district"), false);


            BindingContext = this;
        }
예제 #16
0
파일: TimeLinePage.cs 프로젝트: meekr/Haima
    public override void addItem(SelectableItem item)
    {
        base.addItem (item);
        item.addEventListner(TouchEvent.TOUCH_MOVED, itemClickHandler);
        item.addEventListner(TouchEvent.TOUCH_STATIONARY, itemClickHandler);
        item.addEventListner(TouchEvent.TOUCH_BEGAN, itemClickHandler);

        item.x	= Stage.instance.stageWidth-120;
        item.y	= (_texture.height-_totalItemNum*50)/2 + item.listIndex*50;
    }
예제 #17
0
파일: SubMenu.cs 프로젝트: meekr/Haima
    public override void addItem(SelectableItem item)
    {
        base.addItem(item);
        item.x	= _currentX;
        item.y	= 5;
        item.id	= "subitem-" + (item.listIndex);
        item.addEventListner(MouseEvent.MOUSE_DOWN, new EventDispatcher.CallBack(itemMouseDownHandler));

        _currentX += (item as GuiMenuItem).defaultTexture.width + 20;
    }
예제 #18
0
        private void btnAddBlank_Click(object sender, RoutedEventArgs e)
        {
            SelectableItem si = new SelectableItem();

            si.Text         = "Basic";
            si.TextTrimming = TextTrimming.CharacterEllipsis;
            si.ShowImage    = false;

            selPanel.AddItem(si);
        }
예제 #19
0
 public void removeItem(SelectableItem item)
 {
     int itemIndex	= _itemAry.IndexOf(item);
     item.listIndex	= -1;
     _itemAry.Remove(item);
     removeChild(item);
     item.parentList	= null;
     for(int i=itemIndex;i<_itemAry.Count;i++){
         _itemAry[i].listIndex = i;
     }
 }
        private void Select(SelectableItem <InspectionStatusEntity> item)
        {
            item.IsSelected = !item.IsSelected;

            if ((selected.Value != null) && (item != selected.Value))
            {
                selected.Value.IsSelected = false;
            }

            selected.Value = item.IsSelected ? item : null;
        }
예제 #21
0
        private void mnuSelEdit_Click(object sender, RoutedEventArgs e)
        {
            SelectableItem si = new SelectableItem();

            si.Text             = "Editable";
            si.AllowTextEditing = true;
            si.TextTrimming     = TextTrimming.CharacterEllipsis;
            si.ShowImage        = false;

            selPanel.AddItem(si);
        }
예제 #22
0
    public void selectItem()
    {
        if (MenuManager.ins.selectedItem != null)
        {
            SelectableItem old = MenuManager.ins.selectedItem.GetComponent <SelectableItem>();
            MenuManager.ins.selectedItem = gameObject;
            old.Invoke("onPointerExit", 0.1f);
        }

        MenuManager.ins.selectedItem = gameObject;
        highlight.enabled            = true;
    }
예제 #23
0
        private void btnAddPhoto_Click(object sender, RoutedEventArgs e)
        {
            SelectableItem si = new SelectableItem();

            si.AllowTextEditing = true;

            si.ImageSource = App.GetResourcesImage("Link", ColorScheme);
            si.ShowImage   = true;

            selPhotos.AddItem(si);
            si.DisplayEditText();
        }
        /// <summary>
        /// Update Catalog values from SelectableItems list
        /// </summary>
        /// <param name="item">The Tapped item</param>
        public void ItemTapped(SelectableItem item)
        {
            item.IsSelected = !item.IsSelected;
            var selectedCodes = this.SelectableItems.Where(s => s.IsSelected)
                                .Select(s => (s.Data as KeyValuePair <string, string>?))
                                .Where(s => s.HasValue)
                                .Select(s => s.Value.Key)
                                .ToList();

            this.SelectedCatalogCodes = selectedCodes;
            this.UpdateSummary();
        }
예제 #25
0
        private void mnuSelImage_Click(object sender, RoutedEventArgs e)
        {
            SelectableItem si = new SelectableItem();

            si.Text         = "Image";
            si.TextTrimming = TextTrimming.CharacterEllipsis;
            si.ShowImage    = true;
            si.ImageSource  = new BitmapImage(new Uri("pack://application:,,,/Resources/Images/ImageColor.png", UriKind.RelativeOrAbsolute));
            si.ImageWidth   = 16;

            selPanel.AddItem(si);
        }
예제 #26
0
        private void tabItem_Click(object?sender, EventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            SelectableItem si = (SelectableItem)sender;

            if (si.CanSelect)
            {
                LoadTab(si.Text);
            }
        }
예제 #27
0
        private Frame CreateRandomBoxView(SelectableItem items)
        {
            var view = new Frame
            {
                BackgroundColor = items.IsSelected ? (Color)Color["Primary"] : (Color)Color["White"],
                BorderColor     = items.IsSelected ? (Color)Color["White"] : (Color)Color["LightBlack"],
                Padding         = new Thickness(20, 10),
                CornerRadius    = 5,
                HasShadow       = false
            }; // Creating New View for design as chip

            //Chip click event
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) =>
            {
                var frameSender = (Frame)s;
                var labelDemo   = (Label)frameSender.Content;
                switch (items.IsSelected)
                {
                case false:
                    view.BackgroundColor = (Color)Color["Primary"];
                    labelDemo.TextColor  = (Color)Color["White"];
                    view.BorderColor     = (Color)Color["White"];
                    items.IsSelected     = true;
                    break;

                case true:
                    view.BackgroundColor = (Color)Color["White"];
                    labelDemo.TextColor  = (Color)Color["Black"];
                    view.BorderColor     = (Color)Color["LightBlack"];
                    items.IsSelected     = false;
                    break;
                }
            };
            view.GestureRecognizers.Add(tapGestureRecognizer);

            // creating new child that holds the value of item list and add in View
            var label = new Label
            {
                Text              = ((Genre)items.Data).Name,
                TextColor         = items.IsSelected ? (Color)Color["White"] : (Color)Color["Black"],
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 16
            };

            view.Content = label;
            return(view);
        }
예제 #28
0
    public void selectItem(SelectableItem item)
    {
        if(_selectedItem==item){
            return;
        }

        if(_selectedItem!=null){
            _selectedItem.unselect();
            _lastSelectedItem	= _selectedItem;
        }
        _selectedItem	= item;
        _selectedItem.select();
        this.dispatchEvent(new GuiEvent(GuiEvent.CHANGE));
    }
예제 #29
0
 void SetupSidebar()
 {
     foreach (UserControl item in grdTests.Children)
     {
         SelectableItem si = new SelectableItem(item.GetType().Name.Replace("Test", ""))
         {
             Tag     = item.Name,
             Padding = new Thickness(3),
             Height  = 28
         };
         si.Click += si_Click;
         stkTabs.AddItem(si);
     }
 }
예제 #30
0
    void ManageSelection(SelectableItem selectedItem)
    {
        if (selectedItem.isEnabled)
        {
            if (selectedItem)
            {
                SelectablePage selectedItemPage = selectedItem.GetComponentInParent <SelectablePage>();

                selectedPage.isSelected = Selected.No;

                switch (selectedItem.selectionType)
                {
                case SelectionManager.SelectionType.MoveNextPage:


                    if (selectedItem.GoToPage)
                    {
                        selectedItemPage.NextPage = selectedItem.GoToPage;
                    }

                    if (selectedItemPage.NextPage)
                    {
                        selectedItemPage.NextPage.isSelected = Selected.Yes;
                    }
                    break;

                case SelectionManager.SelectionType.MovePreviousPage:
                    if (selectedItemPage.PreviousPage)
                    {
                        selectedItemPage.PreviousPage.isSelected = Selected.Yes;
                    }
                    break;

                case SelectionManager.SelectionType.LoadsGame:

                    UnityEngine.SceneManagement.SceneManager.LoadScene(1);

                    break;


                default:
                    selectedPage.isSelected = Selected.Yes;
                    break;
                }

                ManageSelectedPages();
            }
        }
    }
예제 #31
0
        private void btnAddEmail_Click(object sender, RoutedEventArgs e)
        {
            SelectableItem si = new SelectableItem();

            si.AllowTextEditing = true;

            if (!ColorScheme.IsHighContrast)
            {
                si.ImageSource = App.GetResourcesImage("Email");
                si.ShowImage   = true;
            }

            selEmails.AddItem(si);
            si.DisplayEditText();
        }
예제 #32
0
        public void LoadUserData(UserData ud)
        {
            cbbProvider.SelectedIndex = (ud.Provider.ToLowerInvariant()) switch
            {
                "google" => 0,
                "github" => 1,
                "jaykebird" => 2,
                "local" => 3,
                _ => 3,
            };

            txtName.Text       = ud.DisplayName;
            txtProfileUrl.Text = ud.ProfileUrl;
            txtUserId.Text     = ud.Id;

            foreach (UserData.Email item in ud.Emails)
            {
                SelectableItem si = new SelectableItem(item.Value);
                si.AllowTextEditing = true;

                //if (!ColorScheme.IsHighContrast)
                //{

                //}

                var img = App.GetResourcesImage("Email", ColorScheme);
                si.ImageSource = img;
                si.ShowImage   = true;

                selEmails.AddItem(si);
            }

            foreach (UserData.Photo item in ud.Photos)
            {
                SelectableItem si = new SelectableItem(item.Value ?? "");
                si.AllowTextEditing = true;

                //if (!ColorScheme.IsHighContrast)
                //{

                //}

                si.ImageSource = App.GetResourcesImage("Link", ColorScheme);
                si.ShowImage   = true;

                selPhotos.AddItem(si);
            }
        }
예제 #33
0
        private void btnEditSetting_Click(object sender, RoutedEventArgs e)
        {
            SelectableItem si = selSheetSettings.GetSelectedItemsOfType <SelectableItem>().First();

            if (si.Tag is KeyValuePair <string, string?> kvp)
            {
                StringInputDialog sid = new StringInputDialog(App.ColorScheme, "Set Setting Value", "Set the value for the setting \"" + kvp.Key + "\":", kvp.Value ?? "");
                sid.SelectTextOnFocus = true;
                sid.ShowDialog();

                if (sid.DialogResult)
                {
                    si.Tag  = new KeyValuePair <string, string?>(kvp.Key, sid.Value);
                    si.Text = "Name: \"" + kvp.Key + "\", Value: \"" + sid.Value + "\"";
                }
            }
        }
예제 #34
0
 public ActionSelectionViewModel(SelectableItem item, SelectableAction[] actions = null)
 {
     m_actions = actions ?? item.ActionsFactory();
     m_title   = item.Title;
     m_traverser.Reset(0, m_actions.Length);
     foreach (var action in m_actions)
     {
         var targetLetter = action.Title.ToLower().FirstOrDefault(letter => !m_actionMapping.ContainsKey(letter));
         if (targetLetter == 0)
         {
             m_actionMapping.Add((char)('0' + m_actions.ToList().IndexOf(action) + 1), action);
         }
         else
         {
             m_actionMapping.Add(targetLetter, action);
         }
     }
 }
        private void Currency_ItemSelected(object sender, SelectableItem i)
        {
            double dCurrFAmt = 0, dCurrFRate = 0, dCurrTAmt = 0, dCurrTRate = 0;

            switch (((ItemSelector)sender).Name)
            {
            case "isCurrFrom":
                btnOk.Enabled    = true;
                txtCurrFrom.Text = i.DisplayText;

                dCurrFRate             = Currency.GetConversionRate(txtCurrFrom.Text);
                txtExRateFromBase.Text = dCurrFRate.ToString("0.0000");

                dCurrTAmt = (m_fixTAmt > 0 ? m_fixTAmt : (double.TryParse(txtCurrToVal.Text, out dCurrTAmt) ? dCurrTAmt : 0));
                if (txtCurrTo.Text.Trim().Length > 0)
                {
                    dCurrTRate = Currency.GetConversionRate(txtCurrTo.Text);
                }
                txtCurrFromVal.Text = (dCurrTAmt * dCurrTRate / dCurrFRate).ToString("0.00");
                break;

            case "isCurrTo":
                txtCurrTo.Text = i.DisplayText;
                if (txtCurrFrom.Text.Length > 0)
                {
                    dCurrFRate = Currency.GetConversionRate(txtCurrFrom.Text);
                    dCurrFAmt  = (double.TryParse(txtCurrFromVal.Text, out dCurrFAmt) ? dCurrFAmt : 0);
                    dCurrTRate = Currency.GetConversionRate(txtCurrTo.Text);

                    txtCurrToVal.Text    = (dCurrFAmt * dCurrFRate / dCurrTRate).ToString("0.00");
                    txtExRateToBase.Text = dCurrTRate.ToString("0.0000");
                }
                else
                {
                    txtCurrToVal.Text = NUMERIC_ZERO;
                }
                txtExRateToBase.Text = Currency.GetConversionRate(txtCurrTo.Text).ToString("0.0000");
                break;
            }
            ValidateAmount();
            txtCurrFromVal.SelectAll();
            //txtCurrFromVal.Focus();
        }
예제 #36
0
        public static void StartProgramOfType(string programType, string path, bool includeAll)
        {
            var programs = Directory.GetFiles(path, $"*.{programType}", includeAll ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);

            if (programs.Length == 0)
            {
                LogService.Log($"No type of {programType} found in {path}.");
                return;
            }

            if (programs.Length > 1)
            {
                var item = new SelectableItem(path + "*." + programType, () => programs.Select(p => new SelectableAction(FileService.GetFileName(p), () => StartProgram(p))).ToArray());
                Viewer.Push(new ActionSelectionViewModel(item));
            }
            else
            {
                StartProgram(programs.First());
            }
        }
예제 #37
0
        public static void StartProgramOfType(string programType, string path, bool includeAll)
        {
            var programs = GetFiles(path, programType, includeAll ? 999 : 1, IgnoredFolders).ToArray();

            if (programs.Length == 0)
            {
                LogService.Log($"No type of {programType} found in {path}.");
                return;
            }

            if (programs.Length > 1)
            {
                var item = new SelectableItem(path + "*." + programType, () => programs.Select(p => new SelectableAction(FileService.GetFileName(p), () => StartProgram(p))).ToArray());
                Viewer.Push(new ActionSelectionViewModel(item));
            }
            else
            {
                StartProgram(programs.First());
            }
        }
예제 #38
0
 void addGallaryItem(SelectableItem item)
 {
     base.addItem(item);
     setChildIndex(item, 0);
     item.height = 686;
     item.addEventListner(GestureEvent.SWIPE, new EventDispatcher.CallBack(gallaryItemTouchEnded));
 }
예제 #39
0
 void addZoomableItem(SelectableItem item)
 {
     base.addItem (item);
     item.addEventListner(MouseEvent.MOUSE_DOWN, zoomableItemClickHandler);
 }
예제 #40
0
    protected void buildGallary()
    {
        XmlNodeList imgs = _node.SelectNodes("img");
        _gallaryItems = new SelectableItem[imgs.Count];
        for (int i=0; i<Math.Min(2, imgs.Count); i++){
            PageType subType = PageType.Single;
            if (imgs[i].Attributes["type"] != null)
                subType = (PageType)Enum.Parse(typeof(PageType), imgs[i].Attributes["type"].Value);

            if (subType != PageType.Single){
                _gallaryItems[i] = new InteractImagePage(imgs[i], _menuElement);
            }
            else{
                _gallaryItems[i] = new SelectableItemEx(imgs[i], _menuElement);	//,1024f,668f);
            }

            _gallaryItems[i].x = (i==0) ? 0 : _screenWidth;
            _gallaryItems[i].id = "gallaryItem-" + i;
            addGallaryItem(_gallaryItems[i]);
        }

        if (imgs.Count > 0){
            Texture2D arrow = Resources.Load("mainMenu/component/arrow-left", typeof(Texture2D)) as Texture2D;
            _left = new SelectableItem(arrow);
            _left.alpha = 0;
            _left.x = 0;
            _left.y = (668-arrow.height)/2f;
            _left.id = "gallary-left-arrow";
            _left.addEventListner(MouseEvent.MOUSE_DOWN, new EventDispatcher.CallBack(leftArrowClicked));
            base.addChild(_left);

            arrow = Resources.Load("mainMenu/component/arrow-right", typeof(Texture2D)) as Texture2D;
            _right = new SelectableItem(arrow);
            _right.alpha = 1f;
            _right.x = _screenWidth-arrow.width;
            _right.y = (668-arrow.height)/2f;
            _right.id = "gallary-right-arrow";
            _right.addEventListner(MouseEvent.MOUSE_DOWN, new EventDispatcher.CallBack(rightArrowClicked));
            base.addChild(_right);
        }
    }
예제 #41
0
 public void unselectItem()
 {
     if(_selectedItem!=null){
         _selectedItem.unselect();
         _selectedItem	= null;
         this.dispatchEvent(new GuiEvent(GuiEvent.CHANGE));
     }
 }