Ejemplo n.º 1
0
        private void NullableComboBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e != null)
            {
                if (e.Key == Key.Delete)
                {
                    ComboBox comboBox = sender as ComboBox;
                    if (comboBox != null)
                    {
                        KStudioEventStream eventStream = comboBox.SelectedItem as KStudioEventStream;
                        if (eventStream != null)
                        {
                            EventStreamState ess = eventStream.UserState as EventStreamState;
                            if (ess != null)
                            {
                                if (ess.SelectedFilePlaybackStream != null)
                                {
                                    EventStreamState ess2 = ess.SelectedFilePlaybackStream.UserState as EventStreamState;

                                    if (ess2 != null)
                                    {
                                        e.Handled = true;

                                        ess2.SelectedLivePlaybackStream = null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SaveStreamSelection()
        {
            Debug.Assert(this.clipSource != null);

            if (this.fileSettingsService != null)
            {
                XElement streamsElement = null;

                if (this.targetAlias == null)
                {
                    streamsElement = this.fileSettingsService.GetSettings(this.clipSource, "streams");
                }
                else
                {
                    streamsElement = this.fileSettingsService.GetSettings(targetAlias, this.clipSource, "streams");
                }

                if (streamsElement != null)
                {
                    streamsElement.RemoveNodes();

                    KStudioEventFile eventFile = this.clipSource as KStudioEventFile;
                    if (eventFile != null)
                    {
                        foreach (KStudioEventStream s in eventFile.EventStreams)
                        {
                            EventStreamState ess = s.UserState as EventStreamState;
                            if (ess != null)
                            {
                                if (ess.SelectedLivePlaybackStream != null)
                                {
                                    XElement streamElement = new XElement("stream");
                                    streamElement.SetAttributeValue("dataTypeId", s.DataTypeId);
                                    streamElement.SetAttributeValue("fileSemanticId", s.SemanticId);
                                    streamElement.SetAttributeValue("liveSemanticId", ess.SelectedLivePlaybackStream.SemanticId);

                                    EventStreamState ess2 = ess.SelectedLivePlaybackStream.UserState as EventStreamState;
                                    if (ess2 != null)
                                    {
                                        if (ess2.IsSelectedForTargetPlayback)
                                        {
                                            streamElement.SetAttributeValue("selected", true.ToString());
                                        }
                                    }

                                    streamsElement.Add(streamElement);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private static string BuildRequirementsToolTip(KStudioEventStream stream, IEnumerable streams, KStudioEventStreamSelectorRequirementFlags process)
        {
            string value = null;

            process = process &= KStudioEventStreamSelectorRequirementFlags.ProcessMask;

            if ((stream != null) && (stream.EventStreamSelectorRequirements != null))
            {
                EventStreamState state = (EventStreamState)stream.UserState;

                StringBuilder sb = new StringBuilder();

                KStudioEventStreamIdentifier emptyIdentifier = new KStudioEventStreamIdentifier();

                foreach (KStudioEventStreamSelectorRequirement requirement in stream.EventStreamSelectorRequirements)
                {
                    if ((requirement.Flags & KStudioEventStreamSelectorRequirementFlags.ProcessMask) == process)
                    {
                        switch (requirement.Flags & KStudioEventStreamSelectorRequirementFlags.OperationMask)
                        {
                        case KStudioEventStreamSelectorRequirementFlags.OperationAll:
                        {
                            string temp = EventStreamState.GetStreamNames((KStudioEventStreamIdentifier)requirement.Identifier0, emptyIdentifier, streams);
                            if (!String.IsNullOrWhiteSpace(temp))
                            {
                                if (sb.Length > 0)
                                {
                                    sb.AppendLine();
                                }

                                sb.AppendFormat(Strings.StreamRequirement_All_Format, temp);
                            }
                        }
                            {
                                string temp = EventStreamState.GetStreamNames((KStudioEventStreamIdentifier)requirement.Identifier1, emptyIdentifier, streams);
                                if (!String.IsNullOrWhiteSpace(temp))
                                {
                                    if (sb.Length > 0)
                                    {
                                        sb.AppendLine();
                                    }

                                    sb.AppendFormat(Strings.StreamRequirement_All_Format, temp);
                                }
                            }
                            break;

                        case KStudioEventStreamSelectorRequirementFlags.OperationNone:
                        {
                            string temp = EventStreamState.GetStreamNames((KStudioEventStreamIdentifier)requirement.Identifier0, (KStudioEventStreamIdentifier)requirement.Identifier1, streams);
                            if (!String.IsNullOrWhiteSpace(temp))
                            {
                                if (sb.Length > 0)
                                {
                                    sb.AppendLine();
                                }

                                sb.AppendFormat(Strings.StreamRequirement_None_Format, temp);
                            }
                        }
                        break;

                        case KStudioEventStreamSelectorRequirementFlags.OperationOr:
                        {
                            string temp = EventStreamState.GetStreamNames((KStudioEventStreamIdentifier)requirement.Identifier0, (KStudioEventStreamIdentifier)requirement.Identifier1, streams);
                            if (!String.IsNullOrWhiteSpace(temp))
                            {
                                if (sb.Length > 0)
                                {
                                    sb.AppendLine();
                                }

                                sb.AppendFormat(Strings.StreamRequirement_Or_Format, temp);
                            }
                        }
                        break;

                        case KStudioEventStreamSelectorRequirementFlags.OperationXor:
                        {
                            string temp = EventStreamState.GetStreamNames((KStudioEventStreamIdentifier)requirement.Identifier0, (KStudioEventStreamIdentifier)requirement.Identifier1, streams);
                            if (!String.IsNullOrWhiteSpace(temp))
                            {
                                if (sb.Length > 0)
                                {
                                    sb.AppendLine();
                                }

                                sb.AppendFormat(Strings.StreamRequirement_Xor_Format, temp);
                            }
                        }
                        break;
                        }
                    }
                }

                value = sb.ToString();
            }

            return(value);
        }