Exemplo n.º 1
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Log.Debug("[MainPage_Loaded] Intialize ...");

            await IntializeFileOperations();

            SpaceFrame.Navigate(typeof(SpacePage));
            SpacePage = SpacePage.Self;

            LayerFrame.Navigate(typeof(LayerPage));
            LayerPage = LayerPage.Self;

            //Start SocketClient
            MaskManager.GetInstance().ShowMask(MaskType.NoSupportDevice);
            Log.Debug("[MainPage_Loaded] Start client thread");
            startclient();
            Log.Debug("[MainPage_Loaded] Start client thread complete");
            LoadSettings();
            Log.Debug("[MainPage_Loaded] LoadSettings complete");
            DeviceUpdatesPage.Self.UpdateButton_Click(null, null);

            var visibleBounds = ApplicationView.GetForCurrentView().VisibleBounds;

            ResizeButton(visibleBounds.Width);
        }
Exemplo n.º 2
0
 private void Clean()
 {
     savedUndoCommand             = null;
     SetLayerButton.IsEnabled     = true;
     SetLayerRectangle.Visibility = Visibility.Collapsed;
     LayerPage.Clean();
     SpacePage.Clean();
 }
Exemplo n.º 3
0
        private string GetUserData()
        {
            XmlNode root = CreateXmlNode("root");

            XmlNode versionNode = CreateXmlNode("version");

            versionNode.InnerText = "1.0";
            root.AppendChild(versionNode);

            root.AppendChild(SpacePage.ToXmlNodeForUserData());
            root.AppendChild(LayerPage.ToXmlNodeForUserData());

            return(root.OuterXml);
        }
Exemplo n.º 4
0
        private void ParsingLayers(XmlNodeList layerNodes)
        {
            foreach (XmlNode node in layerNodes)
            {
                XmlElement element   = (XmlElement)node;
                string     layerName = element.GetAttribute("name");
                string     eye       = element.GetAttribute("Eye");
                LayerModel layer     = new LayerModel(layerName);
                layer.Eye = bool.Parse(eye);

                layer.TriggerAction = element.GetAttribute("trigger");

                // parsing effects
                XmlNode effectsNode = element.SelectSingleNode("effects");
                foreach (XmlNode effectNode in effectsNode.ChildNodes)
                {
                    XmlElement element2 = (XmlElement)effectNode;
                    int        type     = Int32.Parse(element2.SelectSingleNode("type").InnerText);

                    List <ColorPointModel> colorPoints = new List <ColorPointModel>();
                    XmlNode colorPointListNode         = element2.SelectSingleNode("colorPointList");
                    foreach (XmlNode colorpoint in colorPointListNode.ChildNodes)
                    {
                        ColorPointModel cp       = new ColorPointModel();
                        XmlElement      element3 = (XmlElement)colorpoint;
                        cp.Color = new Color
                        {
                            A = Byte.Parse(element3.SelectSingleNode("a").InnerText),
                            R = Byte.Parse(element3.SelectSingleNode("r").InnerText),
                            G = Byte.Parse(element3.SelectSingleNode("g").InnerText),
                            B = Byte.Parse(element3.SelectSingleNode("b").InnerText),
                        };
                        cp.Offset = double.Parse(element3.SelectSingleNode("offset").InnerText);
                        colorPoints.Add(cp);
                    }

                    EffectInfoModel info = new EffectInfoModel(type)
                    {
                        InitColor = new Color
                        {
                            A = Byte.Parse(element2.SelectSingleNode("a").InnerText),
                            R = Byte.Parse(element2.SelectSingleNode("r").InnerText),
                            G = Byte.Parse(element2.SelectSingleNode("g").InnerText),
                            B = Byte.Parse(element2.SelectSingleNode("b").InnerText),
                        },
                        DoubleColor1 = new Color
                        {
                            A = Byte.Parse(element2.SelectSingleNode("d1a").InnerText),
                            R = Byte.Parse(element2.SelectSingleNode("d1r").InnerText),
                            G = Byte.Parse(element2.SelectSingleNode("d1g").InnerText),
                            B = Byte.Parse(element2.SelectSingleNode("d1b").InnerText),
                        },
                        DoubleColor2 = new Color
                        {
                            A = Byte.Parse(element2.SelectSingleNode("d2a").InnerText),
                            R = Byte.Parse(element2.SelectSingleNode("d2r").InnerText),
                            G = Byte.Parse(element2.SelectSingleNode("d2g").InnerText),
                            B = Byte.Parse(element2.SelectSingleNode("d2b").InnerText),
                        },
                        Type               = type,
                        Speed              = Int32.Parse(element2.SelectSingleNode("speed").InnerText),
                        Angle              = Int32.Parse(element2.SelectSingleNode("angle").InnerText),
                        RandomRangeMax     = Int32.Parse(element2.SelectSingleNode("randomRangeMax").InnerText),
                        RandomRangeMin     = Int32.Parse(element2.SelectSingleNode("randomRangeMin").InnerText),
                        ColorModeSelection = Int32.Parse(element2.SelectSingleNode("colormodeselection").InnerText),
                        High               = Int32.Parse(element2.SelectSingleNode("high").InnerText),
                        Low                   = Int32.Parse(element2.SelectSingleNode("low").InnerText),
                        PatternSelect         = Int32.Parse(element2.SelectSingleNode("patternSelect").InnerText),
                        CustomizedPattern     = new List <ColorPointModel>(colorPoints),
                        ColorSegmentation     = bool.Parse(element2.SelectSingleNode("colorSegmentation").InnerText),
                        RainbowSpecialEffects = bool.Parse(element2.SelectSingleNode("rainbowRotation").InnerText),
                        RainbowSpecialMode    = Int32.Parse(element2.SelectSingleNode("rotationMode").InnerText),
                    };

                    if (!IsTriggerEffect(type))
                    {
                        TimelineEffect eff = new TimelineEffect(type);
                        eff.StartTime    = Int32.Parse(element2.SelectSingleNode("start").InnerText);
                        eff.DurationTime = Int32.Parse(element2.SelectSingleNode("duration").InnerText);
                        eff.Info         = info;
                        layer.AddTimelineEffect(new EffectLineViewModel(eff));
                    }
                    else
                    {
                        TriggerEffect eff = new TriggerEffect(type);
                        eff.StartTime    = Int32.Parse(element2.SelectSingleNode("start").InnerText);
                        eff.DurationTime = Int32.Parse(element2.SelectSingleNode("duration").InnerText);
                        eff.Info         = info;
                        layer.AddTriggerEffect(eff);
                        layer.IsTriggering = true;
                    }
                }

                // parsing zones
                XmlNode devicesNode = element.SelectSingleNode("devices");
                foreach (XmlNode deviceNode in devicesNode.ChildNodes)
                {
                    Dictionary <int, int[]> zoneDictionary = new Dictionary <int, int[]>();
                    List <int> zones    = new List <int>();
                    XmlElement element2 = (XmlElement)deviceNode;
                    string     typeName = element2.GetAttribute("type");
                    int        type     = GetTypeByTypeName(typeName);

                    XmlNodeList indexNodes = element2.ChildNodes;
                    foreach (XmlNode index in indexNodes)
                    {
                        zones.Add(Int32.Parse(index.InnerText));
                    }

                    zoneDictionary.Add(type, zones.ToArray());
                    layer.AddDeviceZones(zoneDictionary);
                }

                LayerPage.AddLayer(layer);
            }
        }
Exemplo n.º 5
0
        public void ShowMask(MaskType type)
        {
            LayerPage layerPage = LayerPage.Self;
            SpacePage spacePage = SpacePage.Self;
            MainPage  mainPage  = MainPage.Self;

            mainPage.ActionBarMask.Visibility           = Visibility.Collapsed;
            mainPage.SettingRelativePanel.Visibility    = Visibility.Visible;
            mainPage.LiveServiceUpdatingMask.Visibility = Visibility.Collapsed;
            mainPage.NoSupportedDeviceGrid.Visibility   = Visibility.Collapsed;
            spacePage.NoSyncDeviceMask.Visibility       = Visibility.Collapsed;
            layerPage.PlayingMask.Visibility            = Visibility.Collapsed;
            mainPage.EditBarRelativePanel.Visibility    = Visibility.Collapsed;
            mainPage.ActionBarRelativePanel.Visibility  = Visibility.Visible;
            mainPage.AvailableButtonMask.Visibility     = Visibility.Collapsed;
            mainPage.FileComboboxMask.Visibility        = Visibility.Collapsed;
            mainPage.EffectBlockMask.Visibility         = Visibility.Collapsed;
            mainPage.EffectInfoMask.Visibility          = Visibility.Collapsed;

            switch (type)
            {
            case MaskType.None:
                break;

            case MaskType.NoSupportDevice:
                mainPage.NoSupportedDeviceGrid.Visibility = Visibility.Visible;
                break;

            case MaskType.NoSyncDevice:
                spacePage.NoSyncDeviceMask.Visibility = Visibility.Visible;
                break;

            case MaskType.Editing:
                mainPage.SettingRelativePanel.Visibility = Visibility.Collapsed;
                layerPage.PlayingMask.Visibility         = Visibility.Visible;
                Canvas.SetZIndex(layerPage.PlayingMask, 5);
                mainPage.EditBarRelativePanel.Visibility   = Visibility.Visible;
                mainPage.ActionBarRelativePanel.Visibility = Visibility.Collapsed;
                mainPage.AvailableButtonMask.Visibility    = Visibility.Visible;
                mainPage.FileComboboxMask.Visibility       = Visibility.Visible;
                mainPage.EffectBlockMask.Visibility        = Visibility.Visible;
                mainPage.EffectInfoMask.Visibility         = Visibility.Visible;
                break;

            case MaskType.Playing:
                mainPage.ActionBarMask.Visibility = Visibility.Visible;
                layerPage.PlayingMask.Visibility  = Visibility.Visible;
                Canvas.SetZIndex(layerPage.PlayingMask, 3);
                mainPage.EditBarRelativePanel.Visibility   = Visibility.Collapsed;
                mainPage.ActionBarRelativePanel.Visibility = Visibility.Visible;
                mainPage.AvailableButtonMask.Visibility    = Visibility.Visible;
                mainPage.FileComboboxMask.Visibility       = Visibility.Visible;
                mainPage.EffectBlockMask.Visibility        = Visibility.Visible;
                mainPage.EffectInfoMask.Visibility         = Visibility.Visible;
                break;

            case MaskType.LiveServiceUpdate:
                mainPage.LiveServiceUpdatingMask.Visibility = Visibility.Visible;
                break;
            }
        }
Exemplo n.º 6
0
        private void PushLayerPage(List <Layer> new_layers, byte new_start)
        {
            LayerPage page = new LayerPage(this, _base_map.Layers, new_layers, _base_map.StartLayer, new_start);

            _h_manager.PushPage(page);
        }
Exemplo n.º 7
0
 public LayerTitle()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
     LayerPage = LayerPage.Self;
 }