Exemplo n.º 1
0
        public async Task PlayAsync(string deviceUniqueId, string friendlyName)
        {
            DevicePlayStateChanged?.Invoke(deviceUniqueId, EState.Playing);
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            if (m_ActivePlayers.ContainsKey(deviceUniqueId) == false)
            {
                m_ActivePlayers.Add(deviceUniqueId, cancellationTokenSource);
            }
            else
            {
                m_ActivePlayers[deviceUniqueId] = cancellationTokenSource;
                Logger.Error("device {0} already existed in m_ActivePlayers", friendlyName);
            }
            try
            {
                await _PlayAsync(deviceUniqueId, cancellationTokenSource).ConfigureAwait(false);
            }
            catch (NullReferenceException e)
            {
                Logger.Error(e, "Error while trying to play, device {0}", friendlyName);
                Snapcast.Instance.ShowNotification("Device not found", string.Format("Couldn't find sound device '{0}'. Has it been unplugged?", friendlyName));
                DevicePlayStateChanged?.Invoke(deviceUniqueId, EState.Stopped);
                m_ActivePlayers.Remove(deviceUniqueId);
                if (System.Windows.MessageBox.Show(string.Format("The audio device '{0}' had been marked for auto-play, but is missing from the system. Would you like to remove it from auto-play?", friendlyName),
                                                   "Snap.Net - Auto-play device missing", System.Windows.MessageBoxButton.YesNo) == System.Windows.MessageBoxResult.Yes)
                {
                    SnapSettings.SetAudioDeviceAutoPlay(deviceUniqueId, false, friendlyName);
                }
            }
        }
Exemplo n.º 2
0
        public UserHandlesDiagramViewModel()
        {
            #region Properties

            first = true;

            // Initialize value for Commands , properies of DiagramViewModel

            DuplicateCommand = new Command(OnDuplicateCommand);

            DeleteCommand = new Command(OnDeleteCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.Rotator | SelectorConstraints.HideDisabledResizer,
            };

            Theme = new OfficeTheme();

            #endregion
        }
Exemplo n.º 3
0
 public LogicCircuitDiagramVM()
 {
     PortVisibility       = PortVisibility.Visible;
     DefaultConnectorType = ConnectorType.Orthogonal;
     Nodes           = new NodeCollection();
     Connectors      = new ConnectorCollection();
     HorizontalRuler = new Ruler();
     VerticalRuler   = new Ruler()
     {
         Orientation = Orientation.Vertical
     };
     Constraints  |= GraphConstraints.Undoable | GraphConstraints.AllowPan | GraphConstraints.Bridging;
     SelectedItems = new SelectorViewModel()
     {
         SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.Resizer,
     };
     PageSettings = new PageSettings();
     SnapSettings = new SnapSettings()
     {
         SnapConstraints = SnapConstraints.ShowLines,
         SnapToObject    = SnapToObject.All,
     };
     DragEnterCommand = new DelegateCommand(OnDragEnterCommand);
     DragOverCommand  = new DelegateCommand(OnDragOverCommand);
     ItemAddedCommand = new DelegateCommand(OnItemAddedCommand);
     DropCommand      = new DelegateCommand(OnDropCommand);
 }
Exemplo n.º 4
0
 private void _Save()
 {
     m_Settings.Port           = int.Parse(tbPort.Text);
     m_Settings.AutoBroadcast  = (bool)cbAutoStart.IsChecked;
     m_Settings.DeviceUniqueId = ((Broadcast.Broadcast.BroadcastDevice)cbDevices.SelectedItem).UniqueId;
     SnapSettings.SaveBroadcastSettings(m_Settings);
 }
Exemplo n.º 5
0
        public ScrollingViewModel()
        {
            ScrollSettings = new ScrollSettings();

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
            };

            PageSettings = new PageSettings()
            {
                PageHeight     = 723,
                PageWidth      = 1124,
                ShowPageBreaks = true,
                MultiplePage   = true,
            };

            SelectedItems = new SelectorViewModel();

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            SelectorChangedCommand = new DelegateCommand(OnSelectorChanged);
        }
Exemplo n.º 6
0
        public GroupingViewModel()
        {
            // Apply new theme, Snapsettings, Ruler  for Diagram.
            Theme = new OfficeTheme();

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
            };

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            NodeViewModel Node1 = CreateNode(100, 100, "Rectangle", "");
            NodeViewModel Node2 = CreateNode(300, 100, "RoundedRectangle", "");
            NodeViewModel Node3 = CreateNode(100, 250, "Ellipse", "Start/Stop");
            NodeViewModel Node4 = CreateNode(300, 250, "PredefinedProcess", "Decision");
            NodeViewModel Node5 = CreateNode(100, 400, "Rectangle", "Process");

            CreateGroup(Node1, Node2);
        }
Exemplo n.º 7
0
        public DiagramVM()
        {
            this.Nodes      = new ObservableCollection <NodeViewModel>();
            this.Connectors = new ObservableCollection <ConnectorViewModel>();
            this.Swimlanes  = new ObservableCollection <SwimlaneViewModel>();
            SnapSettings    = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.None,
            };

            SelectedItems = new SelectorViewModel();

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };
            InitializeDiagram();
            NewCommand  = new Command(OnNew);
            LoadCommand = new Command(OnLoad);
            SaveCommand = new Command(OnSave);
        }
Exemplo n.º 8
0
 public NetworkDiagramVM()
 {
     DefaultConnectorType = ConnectorType.Line;
     PortVisibility       = PortVisibility.Visible;
     Nodes           = new NodeCollection();
     Connectors      = new ConnectorCollection();
     Groups          = new GroupCollection();
     PageSettings    = new PageSettings();
     HorizontalRuler = new Ruler();
     VerticalRuler   = new Ruler()
     {
         Orientation = Orientation.Vertical
     };
     Constraints           |= GraphConstraints.Undoable;
     AnnotationConstraints |= AnnotationConstraints.Selectable | AnnotationConstraints.Draggable | AnnotationConstraints.Editable | AnnotationConstraints.Resizable;
     SelectedItems          = new SelectorViewModel();
     SnapSettings           = new SnapSettings()
     {
         SnapConstraints = SnapConstraints.ShowLines | SnapConstraints.SnapToLines,
         SnapToObject    = SnapToObject.All,
     };
     DragEnterCommand = new DelegateCommand(OnDragEnterCommand);
     DragOverCommand  = new DelegateCommand(OnDragOverCommand);
     ItemAddedCommand = new DelegateCommand(OnItemAddedCommand);
     DropCommand      = new DelegateCommand(OnDropCommand);
 }
Exemplo n.º 9
0
        private void OpenSnapPreferences()
        {
            SnapSettings snapPrefWindow = new SnapSettings();

            snapPrefWindow.Owner = Application.Current.MainWindow;
            snapPrefWindow.ShowDialog();
        }
Exemplo n.º 10
0
 private void BroadcastSettings_OnLoaded(object sender, RoutedEventArgs e)
 {
     m_Settings            = SnapSettings.GetBroadcastSettings();
     tbPort.Text           = m_Settings.Port.ToString();
     cbAutoStart.IsChecked = m_Settings.AutoBroadcast;
     _OnBroadcastStateChanged(m_Broadcast.State, m_DeviceName);
     _ListDevices();
 }
Exemplo n.º 11
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            m_Player.OnSnapClientErrored    += Player_OnSnapClientErrored;// force device refresh if errors happened (to avoid confusing in case device got disconnected)
            m_Player.DevicePlayStateChanged += Player_DevicePlayStateChanged;
            m_DeviceAutoPlayFlags            = SnapSettings.GetDeviceAutoPlayFlags();

            _ListDevices();
        }
Exemplo n.º 12
0
 public ChiselSnappingToggle(string iconName, string tooltipName, SnapSettings flags)
     : base(iconName, tooltipName)
 {
     settingsFlag = flags;
     ToolManager.activeToolChanged         -= OnToolModeChanged;
     ToolManager.activeToolChanged         += OnToolModeChanged;
     ChiselEditToolBase.SnapSettingChanged -= OnSnapSettingChanged;
     ChiselEditToolBase.SnapSettingChanged += OnSnapSettingChanged;
 }
Exemplo n.º 13
0
        public EventDiagramVM()
        {
            #region Diagram Properties Initialization

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            PageSettings = new PageSettings()
            {
                PageBackground = new SolidColorBrush(Colors.White),
            };

            Constraints.Add(GraphConstraints.Drop);

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            #endregion

            #region Commands

            Clear = new Command(OnClearCommand);

            AnnotationChangedCommand      = new Command(OnAnnotationChanged);
            AutoScrolledCommand           = new Command(OnAutoScrollChanged);
            ConnectorEditingCommand       = new Command(OnConnectorEditing);
            ConnectorSourceChangedCommand = new Command(OnConnectorSourceChanged);
            ConnectorTargetChangedCommand = new Command(OnConnectorTargetChanged);
            DragEnterCommand        = new Command(OnDragEnter);
            DragLeaveCommand        = new Command(OnDragLeave);
            DragOverCommand         = new Command(OnDragOver);
            DropCommand             = new Command(OnDrop);
            ItemAddedCommand        = new Command(OnItemAdded);
            ItemDeletedCommand      = new Command(OnItemDeleted);
            ItemDoubleTappedCommand = new Command(OnItemDoupleTapped);
            ItemSelectedCommand     = new Command(OnItemSelected);
            ItemTappedCommand       = new Command(OnItemTapped);
            ItemUnSelectedCommand   = new Command(OnItemUnSelected);
            MenuItemClickedCommand  = new Command(OnMenuItemClicked);
            MenuOpeningCommand      = new Command(OnMenuOpening);
            NodeChangedCommand      = new Command(OnNodeChanged);

            #endregion
        }
Exemplo n.º 14
0
        public Flowchart()
        {
            // Initialize Ruler for SfDiagram
            HorizontalRuler = new Ruler {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler {
                Orientation = Orientation.Vertical
            };

            //This command will get invoked when an item is added to the diagram.
            ItemAddedCommand = new Command(args => OnItemAdded((ItemAddedEventArgs)args));

            // Initialize Gridlines for SfDiagram
            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            //Initialize Context menu for diagram.
            Menu = null;

            // Initialize DataSourceSettings for SfDiagram
            DataSourceSettings = new FlowchartDataSourceSettings()
            {
                ParentId             = "ParentId",
                Id                   = "Id",
                DataSource           = GetData(),
                ConnectorTextMapping = "Label",
                ContentMapping       = "Name",
                ShapeMapping         = "_Shape",
                WidthMapping         = "_Width",
                HeightMapping        = "_Height"
            };

            // Initialize LayoutSettings for SfDiagram
            LayoutManager = new LayoutManager()
            {
                Layout = new FlowchartLayout()
                {
                    Orientation     = FlowchartOrientation.TopToBottom,
                    YesBranchValues = new List <string> {
                        "Yes", "True", "Y", "s"
                    },
                    YesBranchDirection = BranchDirection.LeftInFlow,
                    NoBranchValues     = new List <string> {
                        "No", "N", "False", "no"
                    },
                    NoBranchDirection = BranchDirection.RightInFlow,
                    HorizontalSpacing = 50,
                    VerticalSpacing   = 50,
                },
            };
        }
Exemplo n.º 15
0
 private void btSave_Click(object sender, RoutedEventArgs e)
 {
     m_Settings.ResampleFormat       = cbSampleFormat.SelectedIndex == 0 ? "" : cbSampleFormat.SelectedItem.ToString();
     m_Settings.ShareMode            = (SnapDotNet.Player.EShareMode)cbSharemode.SelectedIndex;
     m_Settings.AutoRestartOnFailure = (bool)cbAutoRestart.IsChecked;
     if (m_Settings.AutoRestartOnFailure)
     {
         m_Settings.RestartAttempts = int.Parse(tbRestartTries.Text, System.Globalization.CultureInfo.CurrentCulture);
     }
     SnapSettings.SaveDeviceSettings(m_Device.UniqueId, m_Settings);
     this.Close();
 }
Exemplo n.º 16
0
        public VisualStyles()
        {
            Nodes = new ObservableCollection <NodeVM>();

            //Collection Changed event to update the Node
            (Nodes as ObservableCollection <NodeVM>).CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    (e.NewItems[0] as NodeVM).Update();
                }
            };

            //Create Nodes
            CreateNodes();

            //Undoable Constraints used to enable/disable Undo/Redo the Action.
            Constraints = Constraints.Add(GraphConstraints.Undoable);

            //SnapConstraints used to control the Vsibility of Gridlines and enable/disable the Snapping.
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            DefaultConnectorType = ConnectorType.Orthogonal;
            ScrollSettings       = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            KnownTypes = GetKnownTypes;

            //PageSettings used to enable the Appearance of Diagram Page.
            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
                PageWidth       = 793.5,
                PageHeight      = 1122.5,
                ShowPageBreaks  = true,
            };

            //Ruler used to Creating Scale models.
            HorizontalRuler = new Ruler();
            VerticalRuler   = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            ItemAddedCommand = new Command(OnItemAddedCommand);
        }
Exemplo n.º 17
0
        public DiagramVM(StorageFile file, bool isValidXml)
        {
            _isValidXml   = isValidXml;
            _file         = file;
            Nodes         = new ObservableCollection <NodeVM>();
            Connectors    = new ObservableCollection <ConnectorVM>();
            Groups        = new ObservableCollection <GroupVM>();
            SelectedItems = new SelectorVM(this);
            Select        = new Command(param => IsSelected = true);
            FirstLoad     = new Command(OnViewLoaded);

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All
            };

            PageSettings = new PageVM();
            (PageSettings as PageVM).InitDiagram(this);
            this.HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            this.VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };
            //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0xEC, G = 0xEC, B = 0xEC });
            //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0x2D, G = 0x2D, B = 0x2D });
            InitLocation();
#if SyncfusionFramework4_5_1
            ExportSettings = new ExportSettings()
            {
                ImageStretch = Stretch.Uniform,
                ExportMode   = ExportMode.PageSettings
            };
            PrintingService = new PrintingService();
#endif
            Export       = new Command(OnExportCommand);
            Captures     = new Command(OnCapturesCommand);
            ClearDiagram = new Command(OnClearCommand);
            Upload       = new Command(Onuploadcommand);
            Draw         = new Command(OnDrawCommand);
            SingleSelect = new Command(OnSingleSelectCommand);
            SelectAll    = new Command(OnSelectAllCommand);
            Manipulate   = new Command(OnManipulateCommand);
            Port         = new Command(OnPortCommand);
            Diagrams     = new ObservableCollection <DiagramVM>();
        }
 public static bool ToggleButton(Rect rect, bool value, SnapSettings active, SnapSettings flag, GUIContent[] content, GUIStyle style)
 {
     if ((active & flag) != flag)
     {
         using (var disableScope = new EditorGUI.DisabledScope(true))
         {
             GUI.Toggle(rect, !ChiselEditorResources.isProSkin, content[0], style);
         }
     }
     else
     {
         value = GUI.Toggle(rect, value, value ? content[1] : content[0], style);
     }
     return(value);
 }
Exemplo n.º 19
0
 public static bool ToggleButton(bool value, SnapSettings active, SnapSettings flag, GUIContent content, GUIStyle style)
 {
     if ((active & flag) != flag)
     {
         using (var disableScope = new EditorGUI.DisabledScope(true))
         {
             GUILayout.Toggle(!ChiselEditorResources.isProSkin, content, style);
         }
     }
     else
     {
         value = GUILayout.Toggle(value, content, style);
     }
     return(value);
 }
Exemplo n.º 20
0
        public FlowExectionViewModel()
        {
            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
            };

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            FlowCommand = new Command(FlowExecution);

            NodeViewModel Node1 = CreateNode(200, 100, "Ellipse", "Begin");
            NodeViewModel Node2 = CreateNode(400, 100, "Rectangle", "Specify collection");
            NodeViewModel Node3 = CreateNode(600, 100, "Diamond", "Particulars required");

            Node3.IsSelected = true;
            NodeViewModel Node4 = CreateNode(800, 100, "Rectangle", "Specify particulars");
            NodeViewModel Node5 = CreateNode(600, 250, "Rectangle", "Design collection");
            NodeViewModel Node6 = CreateNode(600, 400, "Rectangle", "Cluster of events");
            NodeViewModel Node7 = CreateNode(800, 400, "Rectangle", "Record and analyze results");
            NodeViewModel Node8 = CreateNode(600, 550, "Rectangle", "Start the process");
            NodeViewModel Node9 = CreateNode(800, 550, "Ellipse", "End");

            ConnectorViewModel Con1 = CreateConnector(Node1, Node2, "");
            ConnectorViewModel Con2 = CreateConnector(Node2, Node3, "");
            ConnectorViewModel Con3 = CreateConnector(Node3, Node4, "Yes");
            ConnectorViewModel Con4 = CreateConnector(Node3, Node5, "No");
            ConnectorViewModel Con5 = CreateConnector(Node4, Node5, "Seg");
            ConnectorViewModel Con6 = CreateConnector(Node5, Node6, "");
            ConnectorViewModel Con7 = CreateConnector(Node7, Node6, "");
            ConnectorViewModel Con8 = CreateConnector(Node6, Node8, "");
            ConnectorViewModel Con9 = CreateConnector(Node8, Node9, "");

            ItemSelectedCommand = new Command(ItemselectedExecution);
        }
Exemplo n.º 21
0
        public UserHandlesDiagramViewModel()
        {
            #region Properties

            first = true;

            // Initialize value for Commands , properies of DiagramViewModel
            DuplicateCommand = new Command(OnDuplicateCommand);
            DeleteCommand    = new Command(OnDeleteCommand);

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.Rotator | SelectorConstraints.HideDisabledResizer,
                Commands            = new QuickCommandCollection()
                {
                    new QuickCommandViewModel()
                    {
                        Shape               = App.Current.Resources["Ellipse"],
                        ShapeStyle          = App.Current.Resources["QuickCommandShapestyle"] as Style,
                        OffsetX             = 1,
                        OffsetY             = 1,
                        Command             = DuplicateCommand,
                        Content             = "M0,2.4879999 L0.986,2.4879999 0.986,9.0139999 6.9950027,9.0139999 6.9950027,10 0.986,10 C0.70400238,10 0.47000122,9.9060001 0.28100207,9.7180004 0.09400177,9.5300007 0,9.2959995 0,9.0139999 z M3.0050011,0 L9.0140038,0 C9.2960014,0 9.5300026,0.093999863 9.7190018,0.28199956 9.906002,0.47000027 10,0.70399952 10,0.986 L10,6.9949989 C10,7.2770004 9.906002,7.5160007 9.7190018,7.7110004 9.5300026,7.9069996 9.2960014,8.0049992 9.0140038,8.0049992 L3.0050011,8.0049992 C2.7070007,8.0049992 2.4650002,7.9069996 2.2770004,7.7110004 2.0890007,7.5160007 1.9950027,7.2770004 1.9950027,6.9949989 L1.9950027,0.986 C1.9950027,0.70399952 2.0890007,0.47000027 2.2770004,0.28199956 2.4650002,0.093999863 2.7070007,0 3.0050011,0 z",
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment   = VerticalAlignment.Center,
                        Margin              = new Thickness(20, 20, 0, 0),
                    }
                },
            };

            ItemAddedCommand = new Command(OnItemAdded);

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            Theme = new OfficeTheme();

            #endregion
        }
        public ConstraintsDiagramVM()
        {
            // Initializing Properties for DiagramViewModel

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default | SelectorConstraints.HideDisabledResizer,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            ItemSelectedCommand = new Command(OnItemSelected);
            first = true;

            #region Nodes and Connectors

            Nodes      = new NodeCollection();
            Connectors = new ConnectorCollection();

            CreateNode(90, "Rectangle", "Selection = False", "Selection");
            CreateNode(290, "Ellipse", "Dragging = False", "Drag");
            CreateNode(490, "Heptagon", "Delete = False", "Delete");
            CreateNode(690, "Cylinder", "Rotate = False", "Rotate");
            CreateNode(890, "Plus", "TextEdit = False", "Edit");
            CreateNode(1090, "Diamond", "Resizing = False", "Resize");
            CreateNodeforLabel("Rectangle", "Node");
            CreateNodeforLabel("Rectangle", "Connector");

            CreateConnector(new Point(40, 500), new Point(190, 600), "Selection = False", "Selection");
            CreateConnector(new Point(240, 500), new Point(390, 600), "Dragging = True", "Drag");
            CreateConnector(new Point(440, 500), new Point(590, 600), "Delete = False", "Delete");
            CreateConnector(new Point(640, 500), new Point(790, 600), "EndThumb = False", "EndThumb");
            CreateConnector(new Point(840, 500), new Point(990, 600), "EndDraggable = False", "EndDraggable");
            CreateConnector(new Point(1040, 500), new Point(1190, 600), "SegmentThumb = False", "SegmentThumb");

            #endregion
        }
Exemplo n.º 23
0
        private async Task _ListDevices()
        {
            SnapDotNet.Player.Device[] devices = await SnapDotNet.Player.Player.GetDevicesAsync();

            m_DeviceControls.Clear();
            spDevices.Children.Clear();
            foreach (SnapDotNet.Player.Device device in devices)
            {
                Controls.Device          d   = new Controls.Device(device);
                SnapDotNet.Player.Device dev = device;
                d.State          = m_Player.GetState(dev.UniqueId);
                d.OnPlayClicked += () =>
                {
                    if (d.State == SnapDotNet.Player.EState.Stopped)
                    {
                        Task play = Task.Run(() => m_Player.PlayAsync(dev.UniqueId, dev.Name));
                        play.ConfigureAwait(false);
                    }
                    else
                    {
                        m_Player.Stop(dev.UniqueId);
                    }
                };

                d.OnSettingsClicked += () =>
                {
                    DeviceSettings settings = new DeviceSettings(device);
                    settings.ShowDialog();
                };

                d.OnAutoPlayToggled += (bool autoPlay) =>
                {
                    SnapSettings.SetAudioDeviceAutoPlay(dev.UniqueId, autoPlay, dev.Name);
                };

                bool autoPlay = false;
                if (m_DeviceAutoPlayFlags.ContainsKey(dev.UniqueId))
                {
                    autoPlay = m_DeviceAutoPlayFlags[dev.UniqueId].Item1;
                }
                d.SetAutoPlay(autoPlay);
                spDevices.Children.Add(d);
                m_DeviceControls.Add(dev.UniqueId, d);
            }
        }
Exemplo n.º 24
0
        static void SetFlagEnabled(SnapSettings flag, bool enabled)
        {
            var prevEnabled = IsFlagEnabled(flag);

            if (prevEnabled == enabled)
            {
                return;
            }
            if (enabled)
            {
                SnapSettings |= flag;
            }
            else
            {
                SnapSettings &= ~flag;
            }
            SnappingSettingsModified?.Invoke();
        }
Exemplo n.º 25
0
        public DiagramVM()
        {
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.None,
            };

            SelectedItems = new SelectorViewModel();

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };
            InitializeDiagram();
        }
Exemplo n.º 26
0
        public SerializationViewModel()
        {
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
            };

            SelectedItems = new SelectorViewModel();

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            CustomNode Node1 = CreateNode(450, 60, "Ellipse", "Start", (SolidColorBrush)(new BrushConverter().ConvertFrom("#D0F0F1")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));
            CustomNode Node2 = CreateNode(450, 210, "Rectangle", "Alarm Rings", (SolidColorBrush)(new BrushConverter().ConvertFrom("#FBFDC5")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));
            CustomNode Node3 = CreateNode(450, 360, "Diamond", "Ready to Get Up?", (SolidColorBrush)(new BrushConverter().ConvertFrom("#C5EFAF")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));
            CustomNode Node4 = CreateNode(700, 360, "Rectangle", "Hit Snooze Button", (SolidColorBrush)(new BrushConverter().ConvertFrom("#FBFDC5")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));
            CustomNode Node5 = CreateNode(700, 210, "Delay", "Delay", (SolidColorBrush)(new BrushConverter().ConvertFrom("#F8EEE5")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));
            CustomNode Node6 = CreateNode(450, 510, "Rectangle", "Climb Out of Bed", (SolidColorBrush)(new BrushConverter().ConvertFrom("#FBFDC5")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));
            CustomNode Node7 = CreateNode(450, 660, "Ellipse", "End", (SolidColorBrush)(new BrushConverter().ConvertFrom("#D0F0F1")), (SolidColorBrush)(new BrushConverter().ConvertFrom("#797979")));

            ConnectorViewModel Con1 = CreateConnector(Node1, Node2, "");
            ConnectorViewModel Con2 = CreateConnector(Node2, Node3, "");
            ConnectorViewModel Con3 = CreateConnector(Node3, Node4, "No");
            ConnectorViewModel Con4 = CreateConnector(Node3, Node6, "Yes");
            ConnectorViewModel Con5 = CreateConnector(Node5, Node2, "After 5 mins");
            ConnectorViewModel Con6 = CreateConnector(Node4, Node5, "");
            ConnectorViewModel Con7 = CreateConnector(Node6, Node7, "");

            NewCommand            = new Command(OnNew);
            LoadCommand           = new Command(OnLoad);
            SaveCommand           = new Command(OnSave);
            ItemAddedCommand      = new Command(ItemAddedExecution);
            ItemSelectedCommand   = new Command(OnItemSelectedCommand);
            ItemUnSelectedCommand = new Command(OnItemUnSelected);
        }
Exemplo n.º 27
0
        public DiagramVM()
        {
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.None,
            };

            SelectedItems = new SelectorViewModel();
            //Adding ItemAdded and NodeChanged commands to diagram.
            ItemAddedCommand   = new DelegateCommand(OnItemAdded);
            NodeChangedCommand = new DelegateCommand(OnNodeChangedCommand);
            HorizontalRuler    = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };
            InitializeDiagram();
        }
Exemplo n.º 28
0
        public DiagramVM(bool IsCustomVM)
        {
            _isCustomVM   = IsCustomVM;
            Nodes         = new ObservableCollection <NodeVM>();
            Connectors    = new ObservableCollection <ConnectorVM>();
            Groups        = new ObservableCollection <GroupVM>();
            SelectedItems = new SelectorVM(this);

            Select    = new Command(param => IsSelected = true);
            FirstLoad = new Command(OnViewLoaded);

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All
            };

            PageSettings = new PageVM();
            (PageSettings as PageVM).InitDiagram(this);

            this.CommandManager.View = (Control)Window.Current.Content;
        }
Exemplo n.º 29
0
        /// <summary>
        /// Checks which devices need to start playing on startup, and plays them
        /// This method should only be called after the control port has connected successfully
        /// </summary>
        public async Task StartAutoPlayAsync()
        {
            // if we were already playing, stop
            if (m_ActivePlayers.Count > 0)
            {
                StopAll();
            }

            // load settings, see if we need to start auto-playing
            Dictionary <string, Tuple <bool, string> > deviceAutoPlayFlags = SnapSettings.GetDeviceAutoPlayFlags();
            List <Task> tasks = new List <Task>();

            foreach (KeyValuePair <string, Tuple <bool, string> > kvp in deviceAutoPlayFlags)
            {
                if (kvp.Value.Item1 == true)
                {
                    Logger.Info("Starting auto-play for {0}", kvp.Value.Item2);
                    tasks.Add(PlayAsync(kvp.Key, kvp.Value.Item2));
                }
            }
            await Task.WhenAll(tasks.ToArray()).ConfigureAwait(false);
        }
Exemplo n.º 30
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            tbHost.Text               = SnapSettings.Server;
            tbControlPort.Text        = SnapSettings.ControlPort.ToString(CultureInfo.CurrentCulture);
            tbPlayerPort.Text         = SnapSettings.PlayerPort.ToString(CultureInfo.CurrentCulture);
            cbAutoLaunch.IsChecked    = SnapSettings.LaunchesOnWindowsStartup();
            lbVersion.Content         = string.Format("{0}: {1}", Snapcast.ProductName, Snapcast.Version);
            cbAutoReconnect.IsChecked = SnapSettings.AutoReconnect;

            System.Tuple <AppTheme, Accent> activeTheme = ThemeManager.DetectAppStyle(Application.Current);

            m_AvailableThemes  = ThemeManager.AppThemes.ToArray();
            m_AvailableAccents = ThemeManager.Accents.ToArray();

            for (int i = 0; i < m_AvailableThemes.Length; i++)
            {
                cbTheme.Items.Add(m_AvailableThemes[i].Name);
                if (m_AvailableThemes[i].Name == activeTheme.Item1.Name)
                {
                    cbTheme.SelectedIndex = i;
                }
            }

            for (int i = 0; i < m_AvailableAccents.Length; i++)
            {
                cbAccent.Items.Add(m_AvailableAccents[i].Name);
                if (m_AvailableAccents[i].Name == activeTheme.Item2.Name)
                {
                    cbAccent.SelectedIndex = i;
                }
            }

            foreach (string s in m_DismissMethods)
            {
                cbDismiss.Items.Add(s);
            }

            cbDismiss.SelectedIndex = (int)SnapSettings.SnapControlDismissMethod;
        }