Ejemplo n.º 1
0
        private void MenuItem_ClickEvent(object sender, EventArgs e)
        {
            UIView.MenuItem item = sender as UIView.MenuItem;
            this.disableMenu(item);
            double time        = 100;
            double position    = this.UIContent.getLeft();
            double itemPostion = 0;

            if (UIContent.Children.Count > 0)
            {
                itemPostion = UIContent.Children[UIContent.Children.Count - 1].getLeft();
            }

            UIContent.Animation_Translate_Frame(double.NaN, double.NaN, position, double.NaN, time, () =>
            {
                if (UIContent.Children.Count > 1)
                {
                    this.UIContent.Children.RemoveAt(0);
                }
                switch (item.Code)
                {
                case "User":
                    // this.UIContent.Children.Clear();
                    GridViewUser tmpItem        = new GridViewUser();
                    tmpItem.BrowserMediaEvent  += tmpItem_BrowserMediaEvent;
                    tmpItem.BrowserCameraEvent += tmpItem_BrowserCameraEvent;
                    tmpItem.Width  = 1366;
                    tmpItem.Height = 668;
                    tmpItem.setLeft(itemPostion + 1366);
                    tmpItem.setTop(0);
                    this.UIContent.Children.Add(tmpItem);
                    break;

                case "Media":
                    // this.UIContent.Children.Clear();
                    GridMedia tmpMediaItem = new GridMedia();
                    tmpMediaItem.Width     = 1366;
                    tmpMediaItem.Height    = 668;
                    tmpMediaItem.setLeft(itemPostion + 1366);
                    tmpMediaItem.setTop(0);
                    tmpMediaItem.User = null;
                    this.UIContent.Children.Add(tmpMediaItem);
                    break;

                case "Camera":
                    // this.UIContent.Children.Clear();
                    GridMedia tmpCameraItem = new GridMedia();
                    tmpCameraItem.Width     = 1366;
                    tmpCameraItem.Height    = 668;
                    tmpCameraItem.setLeft(itemPostion + 1366);
                    tmpCameraItem.setTop(0);
                    tmpCameraItem.TypeMedia = 2;
                    this.UIContent.Children.Add(tmpCameraItem);
                    break;

                case "Device":
                    // this.UIContent.Children.Clear();
                    GridViewDevice tmpDeviceItem = new GridViewDevice();
                    tmpDeviceItem.Width          = 1366;
                    tmpDeviceItem.Height         = 668;
                    tmpDeviceItem.setLeft(itemPostion + 1366);
                    tmpDeviceItem.setTop(0);
                    this.UIContent.Children.Add(tmpDeviceItem);
                    break;

                case "Schedule":
                    // this.UIContent.Children.Clear();
                    MTC_Server.UIView.Schedule.UISchedule tmpCalendar = new UIView.Schedule.UISchedule();
                    tmpCalendar.Width  = 1366;
                    tmpCalendar.Height = 668;
                    tmpCalendar.setLeft(itemPostion + 1366);
                    tmpCalendar.setTop(0);
                    this.UIContent.Children.Add(tmpCalendar);
                    break;

                case "Playlist":
                    // this.UIContent.Children.Clear();
                    MTC_Server.UIView.Playlist.GridPlaylist tmpPlaylist = new MTC_Server.UIView.Playlist.GridPlaylist();
                    tmpPlaylist.Width  = 1366;
                    tmpPlaylist.Height = 668;
                    tmpPlaylist.setLeft(itemPostion + 1366);
                    tmpPlaylist.setTop(0);
                    this.UIContent.Children.Add(tmpPlaylist);
                    break;

                case "About":
                    About window = new About();
                    window.Show();
                    return;
                }
                this.UIContent.Animation_Translate_Frame(double.NaN, double.NaN, -itemPostion - 1366, double.NaN, 600,
                                                         () =>
                {
                    if (UIContent.Children.Count != 0)
                    {
                        this.UIContent.Children.RemoveAt(0);
                    }
                });
            });
        }
        private void MenuItem_ClickEvent(object sender, EventArgs e)
        {
            UIView.MenuItem item = sender as UIView.MenuItem;
            this.disableMenu(item);
            double time = 100;
            double position = this.UIContent.getLeft();
            double itemPostion = 0;
            if (UIContent.Children.Count > 0)
            {
                itemPostion = UIContent.Children[UIContent.Children.Count - 1].getLeft();
            }

            UIContent.Animation_Translate_Frame(double.NaN, double.NaN, position, double.NaN, time, () =>
            {
                if (UIContent.Children.Count > 1)
                {
                    this.UIContent.Children.RemoveAt(0);
                }
                switch (item.Code)
                {
                    case "User":
                        // this.UIContent.Children.Clear();
                        GridViewUser tmpItem = new GridViewUser();
                        tmpItem.BrowserMediaEvent += tmpItem_BrowserMediaEvent;
                        tmpItem.BrowserCameraEvent += tmpItem_BrowserCameraEvent;
                        tmpItem.Width = 1366;
                        tmpItem.Height = 668;
                        tmpItem.setLeft(itemPostion + 1366);
                        tmpItem.setTop(0);
                        this.UIContent.Children.Add(tmpItem);
                        break;
                    case "Media":
                        // this.UIContent.Children.Clear();
                        GridMedia tmpMediaItem = new GridMedia();
                        tmpMediaItem.Width = 1366;
                        tmpMediaItem.Height = 668;
                        tmpMediaItem.setLeft(itemPostion + 1366);
                        tmpMediaItem.setTop(0);
                        tmpMediaItem.User = null;
                        this.UIContent.Children.Add(tmpMediaItem);
                        break;
                    case "Camera":
                        // this.UIContent.Children.Clear();
                        GridMedia tmpCameraItem = new GridMedia();
                        tmpCameraItem.Width = 1366;
                        tmpCameraItem.Height = 668;
                        tmpCameraItem.setLeft(itemPostion + 1366);
                        tmpCameraItem.setTop(0);
                        tmpCameraItem.TypeMedia = 2;
                        this.UIContent.Children.Add(tmpCameraItem);
                        break;
                    case "Device":
                        // this.UIContent.Children.Clear();
                        GridViewDevice tmpDeviceItem = new GridViewDevice();
                        tmpDeviceItem.Width = 1366;
                        tmpDeviceItem.Height = 668;
                        tmpDeviceItem.setLeft(itemPostion + 1366);
                        tmpDeviceItem.setTop(0);
                        this.UIContent.Children.Add(tmpDeviceItem);
                        break;
                    case "Schedule":
                        // this.UIContent.Children.Clear();
                        MTC_Server.UIView.Schedule.UISchedule tmpCalendar = new UIView.Schedule.UISchedule();
                        tmpCalendar.Width = 1366;
                        tmpCalendar.Height = 668;
                        tmpCalendar.setLeft(itemPostion + 1366);
                        tmpCalendar.setTop(0);
                        this.UIContent.Children.Add(tmpCalendar);
                        break;
                    case "Playlist":
                        // this.UIContent.Children.Clear();
                        MTC_Server.UIView.Playlist.GridPlaylist tmpPlaylist = new MTC_Server.UIView.Playlist.GridPlaylist();
                        tmpPlaylist.Width = 1366;
                        tmpPlaylist.Height = 668;
                        tmpPlaylist.setLeft(itemPostion + 1366);
                        tmpPlaylist.setTop(0);
                        this.UIContent.Children.Add(tmpPlaylist);
                        break;
                    case "About":
                        About window = new About();
                        window.Show();
                        return;
                }
                this.UIContent.Animation_Translate_Frame(double.NaN, double.NaN, -itemPostion - 1366, double.NaN, 600,
                () =>
                {
                    if (UIContent.Children.Count != 0)
                        this.UIContent.Children.RemoveAt(0);
                });
            });
        }