コード例 #1
0
        public ActionResult Create(bool another, StreamViewModel streamViewModel)
        {
            string userId = User.Identity.GetUserId();
            var    user   = db.Managers.Find(userId);

            if (ModelState.IsValid)
            {
                var exist = user.school.Streams.ToList().Find(p => p.name.ToLower() == streamViewModel.name.ToLower());
                if (exist != null)
                {
                    ModelState.AddModelError("", streamViewModel.name + " Stream already exists.");
                    return(View());
                }
                var stream = new Stream {
                    name = streamViewModel.name, school = user.school
                };
                db.Streams.Add(stream);
                db.SaveChanges();
                if (another == true)
                {
                    return(RedirectToAction("Create"));
                }
                return(RedirectToAction("Create", "Subjects"));
            }

            return(View(streamViewModel));
        }
コード例 #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var navigationArgs = e.Parameter.ToString();

            var loadData = e.NavigationMode != NavigationMode.Back;

            _viewModel  = ServiceLocator.Current.GetInstance <StreamViewModel>(loadData);
            DataContext = _viewModel;

            _viewModel.Photos.LoadingFinished += Photos_LoadingFinished;

            if (loadData)
            {
                if (navigationArgs.Contains(typeof(StreamViewModelArgs).Name))
                {
                    var args = SerializationHelper.Deserialize <StreamViewModelArgs>(e.Parameter as string);

                    await _viewModel.LoadState(args);
                }
                else if (navigationArgs.Contains(typeof(StreamViewModelThumbnailArgs).Name))
                {
                    var args = SerializationHelper.Deserialize <StreamViewModelThumbnailArgs>(e.Parameter as string);

                    await _viewModel.LoadState(args);
                }
            }
        }
コード例 #3
0
        public PropertyVideoViewModel(StreamViewModel parent, PropertyVideoModel model) : base(parent)
        {
            _model            = model;
            ShowBorderCommand = new DelegateCommand(ShowBorder);

            //selectAreaManager = new App.Managers.SelectAreaManager(this);
        }
コード例 #4
0
        public IActionResult Stop([FromForm] StreamViewModel urlModel)
        {
            // cancel a task
            StreamRadioRipper.StopStream(urlModel?.Url);

            return(Ok("Stop stream request received!"));
        }
コード例 #5
0
        public ActionResult News(int?page)
        {
            var pageSize   = 4;
            var pageNumber = (page ?? 1);
            var model      = new StreamViewModel()
            {
                HeaderText         = BackendService.GetValueByTag("site_header_text"),
                FooterAddress      = BackendService.GetValueByTag("official_address"),
                FooterRequisites   = BackendService.GetValueByTag("official_requisites"),
                MainTitle          = BackendService.GetValueByTag("not_official_name"),
                FooterEmail        = BackendService.GetValueByTag("main_email"),
                FooterPhones       = BackendService.GetValueByTag("main_phones"),
                DeliveryNetVersion = BackendService.GetValueByTag("current_server_version"),
                CabinetLink        = BackendService.GetValueByTag("current_admin_app_address"),
                Slogan             = BackendService.GetValueByTag("slogan_title"),
                Skype      = BackendService.GetValueByTag("main_skype"),
                FooterBody = BackendService.GetValueByTag("footer_body"),
                Paging     = true
            };

            AllNews = NewsService.GetAllGuestOrderByCreateDate();
            if (AllNews.Count() <= pageSize)
            {
                model.Paging = false;
            }
            //model.LatestNews = AllNews[0];
            //AllNews.RemoveAt(0);
            model.News = AllNews.ToPagedList(pageNumber, pageSize);

            return(View(model));
        }
コード例 #6
0
 public PropertyBaseViewModel(StreamViewModel parent) : base(parent)
 {
     Parent              = parent;
     DialogService       = ServiceLocator.GetInstance <IDialogService>();
     DialogViewModel     = BuildDialogViewModel();
     ShowSettingsCommand = new DelegateCommand <WindowViewModel>(ShowSettings);
 }
コード例 #7
0
        private void UpdateReceiver(StreamViewModel stream, Component receiver, double progress)
        {
            StreamViewModel s = stream;

            s.progress = progress;
            element.UpdateReciever(s);
        }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        StreamViewModel viewModel = StreamViewModel.Instance;

        viewModel.bodyStream.onValueChanged += OnBodyStreamChanged;

        jointGOs = new Dictionary <Astra.JointType, GameObject>();
        for (int i = 0; i < 19; ++i)
        {
            var jointGO = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            jointGO.name = ((Astra.JointType)i).ToString();
            jointGO.transform.localScale = new Vector3(100f, 100f, 100f);
            jointGO.transform.SetParent(transform, false);
            jointGO.GetComponent <MeshRenderer>().material = new Material(Shader.Find("Diffuse"));
            jointGO.SetActive(false);
            jointGOs.Add((Astra.JointType)i, jointGO);
        }

        jointLines = new LineRenderer[15];
        for (int i = 0; i < jointLines.Length; ++i)
        {
            var jointLineGO = new GameObject("Line");
            jointLineGO.transform.SetParent(transform, false);
            var jointLine = jointLineGO.AddComponent <LineRenderer>();
            jointLine.material = new Material(Shader.Find("Diffuse"));
            jointLine.SetWidth(0.1f, 0.1f);
            jointLineGO.SetActive(false);
            jointLines[i] = jointLine;
        }
    }
コード例 #9
0
        public IActionResult CreateMessage(int courseId, Stream stream)
        {
            IList <Stream> streams = new List <Stream>();
            var            course  = _classesRepository.Classes.FirstOrDefault(d => d.Id == courseId);

            if (course == null)
            {
                return(View("~/Views/Home/Index.cshtml"));
            }

            var StreamModel = new StreamViewModel
            {
                stream = stream,
                course = course
            };

            StreamModel.stream.Class    = course;
            StreamModel.stream.dateTime = DateTime.Now;
            _streamRepository.AddMessage(StreamModel.stream);

            foreach (Stream stream1 in _appDbContext.StreamMessages)
            {
                streams.Add(stream1);
            }

            var ClassStreamVM = new ClassStreamViewModel
            {
                Class   = course,
                stream  = stream,
                streams = streams
            };

            return(RedirectToAction("Class", new { courseId = courseId }));
        }
コード例 #10
0
        public DeleteViewModel(StreamViewModel stream) : base(stream)
        {
            _stream = stream ?? throw new ArgumentNullException(nameof(stream));

            DeleteCommand = new DelegateCommand <Window>(SetDialogResult);
            DialogText    = string.Format(_dialogTextFormat, _stream.Name);
        }
コード例 #11
0
        public StreamView()
        {
            InitializeComponent();

            var api = DependencyService.Get <IApi>();

            BindingContext = new StreamViewModel(api);
        }
コード例 #12
0
    void Awake()
    {
        StreamViewModel viewModel = StreamViewModel.Instance;

        depthButton.onClick.AddListener(() =>
        {
            viewModel.depthStream.Value = !viewModel.depthStream.Value;
            depthButton.OnOff(viewModel.depthStream.Value);
        });
        colorButton.onClick.AddListener(() =>
        {
            viewModel.colorStream.Value = !viewModel.colorStream.Value;
            colorButton.OnOff(viewModel.colorStream.Value);
        });
        bodyButton.onClick.AddListener(() =>
        {
            viewModel.bodyStream.Value = !viewModel.bodyStream.Value;
            bodyButton.OnOff(viewModel.bodyStream.Value);
        });
        maskedColorButton.onClick.AddListener(() =>
        {
            viewModel.maskedColorStream.Value = !viewModel.maskedColorStream.Value;
            maskedColorButton.OnOff(viewModel.maskedColorStream.Value);
        });
        colorizedBodyButton.onClick.AddListener(() =>
        {
            viewModel.colorizedBodyStream.Value = !viewModel.colorizedBodyStream.Value;
            colorizedBodyButton.OnOff(viewModel.colorizedBodyStream.Value);
        });

        AstraManager.Instance.OnInitializeFailed.AddListener(() =>
        {
            depthButton.interactable         = false;
            colorButton.interactable         = false;
            bodyButton.interactable          = false;
            maskedColorButton.interactable   = false;
            colorizedBodyButton.interactable = false;
        });

        AstraManager.Instance.OnInitializeSuccess.AddListener(() =>
        {
            viewModel.depthStream.Value = true;
            depthButton.OnOff(viewModel.depthStream.Value);

            var pid = AstraManager.Instance.DepthStream.usbInfo.Pid;
            if (pid == Constant.BUS_CL_PID)
            {
                colorButton.interactable         = false;
                maskedColorButton.interactable   = false;
                colorizedBodyButton.interactable = false;
            }
            else
            {
                viewModel.colorStream.Value = true;
                colorButton.OnOff(viewModel.colorStream.Value);
            }
        });
    }
コード例 #13
0
        public SampleStreamDemo()
        {
            InitializeComponent();

            var streamVM = new StreamViewModel();

            DataContext    = streamVM;
            jsonCollection = streamVM.JsonContent;
        }
コード例 #14
0
        public void TestDPs()
        {
            StreamViewModel model = new StreamViewModel(s_TestStream);
            ;
            model.SetValue(StreamViewModel.StreamPositionProperty, 0xEADL);
            model.SetValue(StreamViewModel.BufferSizeProperty, 0xBCD);

            Assert.Equal(0xEADL, model.StreamPosition);
            Assert.Equal(0xBCD, model.BufferSize);
        }
コード例 #15
0
ファイル: MainWindow.xaml.cs プロジェクト: x0rzkov/tweetinvi
        public MainWindow()
        {
            InitializeComponent();

            DataContext = this;
            StreamVM    = new StreamViewModel();
            StreamVM.Authenticate();

            Loaded += OnLoaded;
        }
コード例 #16
0
            public void Should_Activate_Auto_Scrolling_By_Default()
            {
                // Given
                var eventAggregator = new Mock <IEventAggregator>();

                // When
                var viewModel = new StreamViewModel(1, eventAggregator.Object);

                // Then
                Assert.True(viewModel.AutoScrollEnabled);
            }
コード例 #17
0
 public IActionResult DeleteFile([FromForm] StreamViewModel urlModel)
 {
     try
     {
         StreamRadioRipper.DeleteSong(urlModel?.Url, urlModel?.FileName);
         return(Ok("Deleted maybe!"));
     } catch (Exception e)
     {
         return(BadRequest(e?.Message));
     }
 }
コード例 #18
0
            public void Can_Resume_If_Auto_Scroll_Is_Disabled()
            {
                // Given
                var eventAggregator = new Mock <IEventAggregator>().Object;
                var viewModel       = new StreamViewModel(1, eventAggregator);

                // When
                viewModel.AutoScrollEnabled = false;

                // Then
                Assert.True(viewModel.CanResume);
            }
コード例 #19
0
            public void Should_Ignore_Publish_Message_If_Message_Origins_From_Thread_With_Other_Id()
            {
                // Given
                var eventAggregator = new Mock <IEventAggregator>().Object;
                var viewModel       = new StreamViewModel(1, eventAggregator);

                // When
                viewModel.Handle(new PublishMessageEvent(2, "Hello World"));

                // Then
                Assert.Equal(string.Empty, viewModel.Output);
            }
コード例 #20
0
            public void Can_Resume_If_Auto_Scroll_Is_Disabled()
            {
                // Given
                var eventAggregator = new Mock<IEventAggregator>().Object;
                var viewModel = new StreamViewModel(1, eventAggregator);

                // When
                viewModel.AutoScrollEnabled = false;

                // Then
                Assert.True(viewModel.CanResume);
            }
コード例 #21
0
            public void Should_Enable_Auto_Scrolling_When_Resumed()
            {
                // Given
                var eventAggregator = new Mock <IEventAggregator>().Object;
                var viewModel       = new StreamViewModel(1, eventAggregator);

                viewModel.AutoScrollEnabled = false;

                // When
                viewModel.Resume();

                // Then
                Assert.True(viewModel.AutoScrollEnabled);
            }
コード例 #22
0
    // Use this for initialization
    void Awake()
    {
        StreamViewModel viewModel = StreamViewModel.Instance;

        viewModel.depthStream.onValueChanged         += OnDepthStreamChanged;
        viewModel.colorStream.onValueChanged         += OnColorStreamChanged;
        viewModel.colorizedBodyStream.onValueChanged += OnColorizedBodyStreamChanged;
        viewModel.maskedColorStream.onValueChanged   += OnMaskedColorStreamChanged;

        depthImage.gameObject.SetActive(false);
        colorImage.gameObject.SetActive(false);
        colorizedBodyImage.gameObject.SetActive(false);
        maskedColorImage.gameObject.SetActive(false);
    }
コード例 #23
0
            public void Should_Disable_Auto_Scrolling_When_Paused()
            {
                // Given
                var eventAggregator = new Mock <IEventAggregator>().Object;
                var viewModel       = new StreamViewModel(1, eventAggregator);

                viewModel.AutoScrollEnabled = true;

                // When
                viewModel.Pause();

                // Then
                Assert.False(viewModel.AutoScrollEnabled);
            }
コード例 #24
0
        public async Task <IActionResult> EditStreamInfo()
        {
            var currentUser = await _userManager.GetUserAsync(User);

            var user = _userRepository.GetUserWithStreamInfo(currentUser.Id);

            var model = new StreamViewModel()
            {
                StreamLink = user.Stream.StreamLink,
                Tittle     = user.Stream.StreamTIttle
            };

            return(View(model));
        }
コード例 #25
0
            public void Should_Notify_When_AutoScroll_Is_Changed()
            {
                var result = false;

                // Given
                var eventAggregator = new Mock<IEventAggregator>().Object;
                var viewModel = new StreamViewModel(1, eventAggregator);
                viewModel.PropertyChanged += (sender, args) => { result = true; };

                // When
                viewModel.AutoScrollEnabled = true;

                // Then
                Assert.True(result);
            }
コード例 #26
0
        public async Task <IActionResult> EditStreamInfo(StreamViewModel model)
        {
            var currentUser = await _userManager.GetUserAsync(User);

            var user = _userRepository.GetUserWithStreamInfo(currentUser.Id);

            if (model.Tittle != user.Stream.StreamTIttle || model.StreamLink != model.StreamLink)
            {
                user.Stream.StreamTIttle = model.Tittle;
                user.Stream.StreamLink   = model.StreamLink;
                _context.Update(user);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #27
0
            public void Should_Notify_When_AutoScroll_Is_Changed()
            {
                var result = false;

                // Given
                var eventAggregator = new Mock <IEventAggregator>().Object;
                var viewModel       = new StreamViewModel(1, eventAggregator);

                viewModel.PropertyChanged += (sender, args) => { result = true; };

                // When
                viewModel.AutoScrollEnabled = true;

                // Then
                Assert.True(result);
            }
コード例 #28
0
        public StreamViewModel FollowerCount()
        {
            var totalFollowers = new StreamViewModel();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://api.twitch.tv/kraken/channels/xkillzx/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var response = client.GetAsync("follows").Result;
                if (response.IsSuccessStatusCode)
                {
                    string  responseString = response.Content.ReadAsStringAsync().Result;
                    dynamic blah           = JsonConvert.DeserializeObject(responseString);
                    totalFollowers.TotalFollowers = blah._total;
                }
            }

            return(totalFollowers);
        }
コード例 #29
0
        private PlotModel genericColumnPlotModel(StreamViewModel viewModel, string yAxisTtitle, double scale = 1)
        {
            var plotModel = new PlotModel();

            plotModel.Axes.Add(new LinearAxis
            {
                Position       = AxisPosition.Left,
                Title          = yAxisTtitle,
                MaximumPadding = 0.05
            });

            var series = new ColumnSeries()
            {
                Background = OxyColor.FromRgb(33, 150, 243), // blue
                FillColor  = OxyColor.FromRgb(255, 165, 0)   // orange
            };

            List <Entry> entries      = viewModel.GetEntries();
            CategoryAxis categoryAxis = new CategoryAxis()
            {
                Position       = AxisPosition.Bottom,
                StringFormat   = DATE_FORMAT,
                Title          = "Date",
                MinimumPadding = 0.05,
                MaximumPadding = 0.05
            };

            if (entries != null)
            {
                foreach (var entry in entries)
                {
                    series.Items.Add(new ColumnItem((int)(entry.value / scale)));
                    categoryAxis.Labels.Add(entry.date.ToString(DATE_FORMAT, Culture));
                }
            }

            plotModel.Axes.Add(categoryAxis);
            plotModel.Series.Add(series);

            return(plotModel);
        }
コード例 #30
0
        private void Start()
        {
            manager = ImportManager.Instance;

            UIDocument document = GetComponent <UIDocument>();

            element = document.rootVisualElement.Q <SpeckleWindowElement>();
            if (element == null)
            {
                Debug.LogWarning($"{this} could not find a {typeof(SpeckleWindowElement)} in {document}");
                return;
            }


            foreach (Transform child in GameObject.FindGameObjectWithTag("Environment").transform)
            {
                GameObject      childGO         = child.gameObject;
                StreamViewModel streamViewModel = new StreamViewModel()
                {
                    streamID   = "local " + child.GetInstanceID(),
                    streamName = child.name
                };
                ReceiverElement e = element.AddReceiver(
                    viewModel: streamViewModel,
                    OnHide: () => {
                    childGO.SetActive(!childGO.activeInHierarchy);
                    element.SetVisibility(streamViewModel, childGO.activeInHierarchy);
                    manager.UpdateBusy();
                },
                    OnUpdate: null,
                    OnRemove: null,
                    enabled: true
                    );

                element.SetVisibility(streamViewModel, childGO.activeInHierarchy);
            }

            manager.OnReadyToReceive += Initialise;
        }
コード例 #31
0
        public ActionResult Stream(int?page)
        {
            var pageSize   = 20;
            var pageNumber = (page ?? 1);
            var model      = new StreamViewModel()
            {
                HeaderText         = BackendService.GetValueByTag("site_header_text"),
                FooterAddress      = BackendService.GetValueByTag("official_address"),
                FooterRequisites   = BackendService.GetValueByTag("official_requisites"),
                MainTitle          = BackendService.GetValueByTag("not_official_name"),
                FooterEmail        = BackendService.GetValueByTag("main_email"),
                FooterPhones       = BackendService.GetValueByTag("main_phones"),
                DeliveryNetVersion = BackendService.GetValueByTag("current_server_version"),
                CabinetLink        = BackendService.GetValueByTag("current_admin_app_address"),
                Slogan             = BackendService.GetValueByTag("slogan_title"),
                Skype      = BackendService.GetValueByTag("main_skype"),
                FooterBody = BackendService.GetValueByTag("footer_body")
            };

            model.News = NewsService.GetAllGuestOrderByCreateDate().ToPagedList(pageNumber, pageSize);
            return(PartialView(model));
        }
コード例 #32
0
            public void Should_Activate_Auto_Scrolling_By_Default()
            {
                // Given
                var eventAggregator = new Mock<IEventAggregator>();

                // When
                var viewModel = new StreamViewModel(1, eventAggregator.Object);

                // Then
                Assert.True(viewModel.AutoScrollEnabled);
            }
コード例 #33
0
            public void Should_Enable_Auto_Scrolling_When_Resumed()
            {
                // Given
                var eventAggregator = new Mock<IEventAggregator>().Object;
                var viewModel = new StreamViewModel(1, eventAggregator);
                viewModel.AutoScrollEnabled = false;

                // When
                viewModel.Resume();

                // Then
                Assert.True(viewModel.AutoScrollEnabled);
            }
コード例 #34
0
            public void Should_Disable_Auto_Scrolling_When_Paused()
            {
                // Given
                var eventAggregator = new Mock<IEventAggregator>().Object;
                var viewModel = new StreamViewModel(1, eventAggregator);
                viewModel.AutoScrollEnabled = true;

                // When
                viewModel.Pause();

                // Then
                Assert.False(viewModel.AutoScrollEnabled);
            }
コード例 #35
0
            public void Should_Ignore_Publish_Message_If_Message_Origins_From_Thread_With_Other_Id()
            {
                // Given
                var eventAggregator = new Mock<IEventAggregator>().Object;
                var viewModel = new StreamViewModel(1, eventAggregator);

                // When
                viewModel.Handle(new PublishMessageEvent(2, "Hello World"));

                // Then
                Assert.Equal(string.Empty, viewModel.Output);
            }
コード例 #36
0
        public async Task <IActionResult> Stream(int id)
        {
            if (!AuthUser.Identity.IsAuthenticated)
            {
                AlertInfo = _sharedLocalizer[Annotations.Interface.SignInForStreams];
                return(RedirectToSignIn());
            }

            Event graEvent = null;

            try
            {
                graEvent = await _eventService.GetDetails(id);
            }
            catch (GraException) { }

            if (graEvent == null &&
                Request.Query.ContainsKey("eventId") &&
                int.TryParse(Request.Query["eventId"], out id))
            {
                try
                {
                    graEvent = await _eventService.GetDetails(id);
                }
                catch (GraException) { }
            }

            if (graEvent == null)
            {
                AlertWarning = _sharedLocalizer[Annotations.Interface.EventNotFound];
                return(RedirectToAction(nameof(StreamingEvents)));
            }

            if (!graEvent.IsStreaming)
            {
                return(RedirectToAction(nameof(Detail), new { id }));
            }
            else
            {
                if (_dateTimeProvider.Now < graEvent.StartDate)
                {
                    AlertWarning = _sharedLocalizer[Annotations.Interface.EventNotStarted];
                    return(RedirectToAction(nameof(Detail), new { id }));
                }
                else if (_dateTimeProvider.Now > graEvent.StreamingAccessEnds)
                {
                    AlertWarning = _sharedLocalizer[Annotations.Interface.EventHasEnded];
                    return(RedirectToAction(nameof(Detail), new { id }));
                }
                else
                {
                    if (graEvent.IsStreamingEmbed)
                    {
                        var viewModel = new StreamViewModel
                        {
                            EventName = graEvent.Name,
                            Embed     = graEvent.StreamingLinkData
                        };

                        if (graEvent.RelatedTriggerId.HasValue &&
                            await GetSiteSettingBoolAsync(SiteSettingKey.Events.StreamingShowCode))
                        {
                            viewModel.SecretCode = await _eventService
                                                   .GetSecretCodeForStreamingEventAsync(graEvent.Id);
                        }

                        return(View(viewModel));
                    }
                    else
                    {
                        return(Redirect(graEvent.StreamingLinkData));
                    }
                }
            }
        }
コード例 #37
0
 public MainPage()
 {
     InitializeComponent();
     StreamVM = new StreamViewModel();
     Loaded  += OnLoaded;
 }
コード例 #38
0
 public void TestByteCollection()
 {
     StreamViewModel model = new StreamViewModel(s_TestStream);
     model.BufferSize = (Int32)s_TestStream.Length;
     //model.ReadBytes();
 }