Ejemplo n.º 1
0
        private void addActiveNodeButton_Click(object sender, RoutedEventArgs e)
        {
            InputStringDialog dialogChooser = new InputStringDialog();

            dialogChooser.Owner = this;
            dialogChooser.Title = "Input node address";
            dialogChooser.ShowDialog();
            if (dialogChooser.DialogResult.Value)
            {
                string node = dialogChooser.inputString;
                if (!string.IsNullOrEmpty(node))
                {
                    if (appRunner.AddNode(node))
                    {
                        activeNodesListBox.Items.Refresh();
                    }
                    else
                    {
                        InfoDialog wrongNodeDialog = new InfoDialog("Node with this address already exists. Active node must have a unique address");
                        wrongNodeDialog.Owner  = this;
                        wrongNodeDialog.Width  = 350;
                        wrongNodeDialog.Height = 200;
                        wrongNodeDialog.Show();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            InfoDialog aboutDialog = new InfoDialog("Application for configuration and launching VR Cluster version " + versionInfo + "\n \u00a9 Copiright Pixela Labs. All rights reserved.\n more info http://vrcluster.io/");

            aboutDialog.Owner  = this;
            aboutDialog.Width  = 350;
            aboutDialog.Height = 200;
            aboutDialog.Show();
        }
Ejemplo n.º 3
0
 private void CopyItem(SceneNodeView _sourceItem, SceneNodeView _targetItem)
 {
     //Alert if node sets as child of it's own child node
     if (_targetItem != null && _sourceItem.FindNodeInChildren(_targetItem) != null)
     {
         InfoDialog alertDialog = new InfoDialog("Scene node can not be a child node of own children!");
         alertDialog.Owner = this;
         alertDialog.Show();
     }
     else
     {
         //Asking user wether he want to drop the dragged TreeViewItem here or not
         YesNoDialog dialogResult = new YesNoDialog("Would you like to drop " + _sourceItem.node.id + " into " + _targetItem.node.id + "");
         dialogResult.Owner = this;
         if ((bool)dialogResult.ShowDialog())
         {
             try
             {
                 //finding Parent TreeViewItem of dragged TreeViewItem
                 SceneNodeView ParentItem = currentConfig.FindParentNode(_sourceItem);
                 if (ParentItem == null)
                 {
                     ((List <SceneNodeView>)sceneNodesTreeView.ItemsSource).Remove(_sourceItem);
                 }
                 else
                 {
                     ParentItem.children.Remove(_sourceItem);
                 }
                 //adding dragged TreeViewItem in target TreeViewItem
                 if (_targetItem == null)
                 {
                     ((List <SceneNodeView>)sceneNodesTreeView.ItemsSource).Add(_sourceItem);
                     _sourceItem.node.parent = null;
                 }
                 else
                 {
                     _targetItem.children.Add(_sourceItem);
                     _sourceItem.node.parent = _targetItem.node;
                 }
                 //Set SceneNode of _targetItem as parent node for _sourceItem Scene Node
             }
             catch
             {
             }
             sceneNodesTreeView.Items.Refresh();
         }
     }
 }
Ejemplo n.º 4
0
 private void Save(bool isSaveAs)
 {
     if (currentConfig.Validate())
     {
         try
         {
             string currentFileName = RegistrySaver.ReadStringFromRegistry(RegistrySaver.configName);
             if (!isSaveAs && File.Exists(currentFileName))
             {
                 File.WriteAllText(currentFileName, currentConfig.CreateConfig());
             }
             else
             {
                 SaveFileDialog saveFileDialog = new SaveFileDialog();
                 saveFileDialog.Filter = configFileExtention;
                 if (saveFileDialog.ShowDialog() == true)
                 {
                     currentFileName    = saveFileDialog.FileName;
                     currentConfig.name = Path.GetFileNameWithoutExtension(currentFileName);
                     RegistrySaver.RemoveAllRegistryValues(RegistrySaver.configName);
                     RegistrySaver.AddRegistryValue(RegistrySaver.configName, currentFileName);
                     File.WriteAllText(currentFileName, currentConfig.CreateConfig());
                 }
             }
             SetTitle();
             AppLogger.Add("Config saved to " + currentFileName);
         }
         catch (Exception exception)
         {
             InfoDialog errorDialog = new InfoDialog("Error! \nCan not save configuration file. \nSee exception message in Log");
             errorDialog.Owner  = this;
             errorDialog.Width  = 350;
             errorDialog.Height = 200;
             errorDialog.Show();
             AppLogger.Add("ERROR! Can not save config to file. EXCEPTION: " + exception.Message);
         }
     }
     else
     {
         InfoDialog errorDialog = new InfoDialog("Error! \nCan not save configuration file. \nWrong config. See errors in Log");
         errorDialog.Owner  = this;
         errorDialog.Width  = 350;
         errorDialog.Height = 200;
         errorDialog.Show();
         AppLogger.Add("ERROR! Can not save config to file. Errors in configuration");
     }
 }