コード例 #1
0
        private void b_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Button         b   = sender as Button;
            RemoteSoftware sof = b.Tag as RemoteSoftware;

            _userCommand.RunRemoteSoftware(sof, SelectedComputer, SelectedItemUser.SamAccountName);
        }
コード例 #2
0
        void b_Click(object sender, RoutedEventArgs e)
        {
            Button         b   = sender as Button;
            RemoteSoftware sof = b.Tag as RemoteSoftware;

            _ComputerCommandsviewModel.RunRemoteSoftware(sof, _selectedComputer);
        }
コード例 #3
0
        private void DoDefaultRadioButtonCommand(object obj)
        {
            RemoteSoftware software = obj as RemoteSoftware;

            if (software != null)
            {
                software.Default = true;
            }
        }
コード例 #4
0
 private void DoDelete(object obj)
 {
     if (obj != null)
     {
         Button b = (obj as System.Windows.Controls.Button);
         if (obRemoteSoftware.Count - 1 != 0)
         {
             RemoteSoftware sof = (b.Tag as RemoteSoftware);
             sof.Isremove = true;
             obRemoteSoftware.Remove(sof);
         }
     }
 }
コード例 #5
0
        private void DoRmoveButtonCommand(object obj)
        {
            RemoteSoftware software = obj as RemoteSoftware;

            if (software != null)
            {
                if (obRemoteSoftware.Count - 1 != 0)
                {
                    software.Isremove = true;
                    obRemoteSoftware.Remove(software);
                }
            }
        }
コード例 #6
0
 private void DoBrows(object obj)
 {
     if (obj != null)
     {
         Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
         Button         b  = obj as Button;
         RemoteSoftware re = (b.Tag as RemoteSoftware);
         dlg.Title = string.Format("Brows for {0} exe", re.Name);
         Nullable <bool> result = dlg.ShowDialog();
         if (result == true)
         {
             re.ProgramPath = dlg.FileName;
         }
     }
 }
コード例 #7
0
        private void DoAddButtonCommand(object obj)
        {
            RemoteSoftware software = obj as RemoteSoftware;


            if (software != null)
            {
                RemoteSoftware Newsoftware = new RemoteSoftware();
                Newsoftware.Name        = software.Name + "1";
                Newsoftware.Index       = obRemoteSoftware.Count;
                Newsoftware.Isremove    = software.Isremove;
                Newsoftware.Options     = software.Options;
                Newsoftware.ProgramPath = software.ProgramPath;


                obRemoteSoftware.Add(Newsoftware);

                //{
                //    Name = "Default Name" + obRemoteSoftware.Count,
                //    Index =
                //});
            }
        }
コード例 #8
0
        protected override void Subscribe()
        {
            MessageBus.Subscribe <ActiveDirectoryObjectPublish>((obj) =>
            {
                SetActiveDirectoryObjectComputers(obj.Ischeck);
            });
            MessageBus.Subscribe <WindowActivated>((arg) =>
            {
                UserShouldEditValueNow = arg.Activated;
            });
            MessageBus.Subscribe <RDPProgram>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerRDP(_selectedComputer);
                }
            });
            MessageBus.Subscribe <CDrive>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerCDrive(_selectedComputer);
                }
            });
            MessageBus.Subscribe <DDrive>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerDDrive(_selectedComputer);
                }
            });
            MessageBus.Subscribe <PingProgram>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerPing(_selectedComputer);
                }
            });
            MessageBus.Subscribe <ManageProgram>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerManage(_selectedComputer);
                }
            });
            MessageBus.Subscribe <DefaultProgram>((obj) =>
            {
                if (listRemoteSoftware != null && listRemoteSoftware.Count != 0)
                {
                    RemoteSoftware rem = listRemoteSoftware.Where(r => r.Default == true).FirstOrDefault();
                    _ComputerCommandsviewModel.RunRemoteSoftware(rem, SelectedComputer);
                }
            });

            MessageBus.Subscribe <ComputerShutdown>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerShutdown(_selectedComputer);
                }
            });
            MessageBus.Subscribe <ComputerRestart>((obj) =>
            {
                if (!string.IsNullOrEmpty(_selectedComputer))
                {
                    _ComputerCommandsviewModel.ComputerRestart(_selectedComputer);
                }
            });
        }
コード例 #9
0
ファイル: XMLApi.cs プロジェクト: itamartz/AmmasoHelpdesk
        public async Task <List <RemoteSoftware> > GetXMLButtons()
        {
            if (!string.IsNullOrEmpty(App.XmlConfigurationFileLocation))
            {
                xmlPathlocation = Path.Combine(App.XmlConfigurationFileLocation, "RemoteSoftwares.xml");
            }
            else
            {
                App.XmlConfigurationFileLocation = System.AppDomain.CurrentDomain.BaseDirectory;
                xmlPathlocation = Path.Combine(App.XmlConfigurationFileLocation, "RemoteSoftwares.xml");



                //xmlPathlocation = "RemoteSoftwares.xml";
            }
            List <RemoteSoftware> listbuttons = new List <RemoteSoftware>();

            #region Linq
            Task t = Task.Run(() =>
            {
                XDocument xml = null;
                if (string.IsNullOrEmpty(xmlPathlocation) || !xmlPathlocation.Contains(".xml"))
                {
                    return;
                }
                try
                {
                    xml = XDocument.Load(xmlPathlocation);
                }
                catch (Exception ex)
                {
                    string str = xmlPathlocation + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine;
                    System.Windows.Forms.MessageBox.Show(str, "GetXMLButtons");
                    #region Old Software
                    //  listbuttons.Add(
                    //      new RemoteSoftware()
                    //      {
                    //          ProgramPath = @"C:\Windows\System32\msra.exe",
                    //          Options = "/offerRA {computerName}",
                    //          Name = "Remote Assist"
                    //      });
                    //  listbuttons.Add(
                    // new RemoteSoftware()
                    //     {
                    //         ProgramPath = @"C:\Program Files\SolarWinds\DameWare Mini Remote Control 10.0\DWRCC.exe",
                    //         Options = "-c: -h: -m:{computerName} -vnc -a:1",
                    //         Name = "VNC"
                    //     });
                    //  listbuttons.Add(
                    //new RemoteSoftware()
                    //{
                    //    ProgramPath = @"C:\Program Files\SolarWinds\DameWare Remote Support 11.0\DWRCC.exe",
                    //    Options = "-c: -h: -m:{computerName} -a:1",
                    //    Name = "DameWare",
                    //    Default = true
                    //});
                    //  listbuttons.Add(
                    //new RemoteSoftware()
                    //{
                    //    ProgramPath = @"C:\Program Files\TeamViewer\Version9\TeamViewer.exe",
                    //    Options = "-i {computerName}",
                    //    Name = "TeamViewer"
                    //});
                    #endregion
                }

                if (xml != null)
                {
                    var Software = xml.Root.Elements("Software").ToList();

                    foreach (var item in Software)
                    {
                        RemoteSoftware _xmlRemoteSoftware = new RemoteSoftware();

                        _xmlRemoteSoftware.Name        = item.Element("Name") == null ? "Name Error" : item.Element("Name").Value.ToString();
                        _xmlRemoteSoftware.Options     = item.Element("Options") == null ? "Options Error" : item.Element("Options").Value.ToString();
                        _xmlRemoteSoftware.ProgramPath = item.Element("ProgramPath") == null ? "ProgramPath Error" : item.Element("ProgramPath").Value.ToString();
                        _xmlRemoteSoftware.Default     = Convert.ToBoolean(item.Element("Default").Value.ToString());
                        //if (item.Element("Column") != null)
                        //    _xmlRemoteSoftware.Column = Convert.ToInt32(item.Element("Column").Value.ToString());
                        listbuttons.Add(_xmlRemoteSoftware);
                    }
                }
            }
                              );


            #endregion
            await Task.WhenAll(t);

            return(listbuttons);
        }
コード例 #10
0
ファイル: XMLApi.cs プロジェクト: itamartz/AmmasoHelpdesk
        public async Task <List <RemoteSoftware> > GetUsersRemoteSoftwares()
        {
            List <RemoteSoftware> listbuttons = new List <RemoteSoftware>();

            if (!string.IsNullOrEmpty(App.XmlConfigurationFileLocation))
            {
                UsersRemoteSoftwares = Path.Combine(App.XmlConfigurationFileLocation, "UsersRemoteSoftwares.xml");
            }
            else
            {
                App.XmlConfigurationFileLocation = System.AppDomain.CurrentDomain.BaseDirectory;
                UsersRemoteSoftwares             = Path.Combine(App.XmlConfigurationFileLocation, "UsersRemoteSoftwares.xml");
            }
            #region Linq
            Task t = Task.Run(() =>
            {
                XDocument xml = null;
                if (string.IsNullOrEmpty(UsersRemoteSoftwares) || !UsersRemoteSoftwares.Contains(".xml"))
                {
                    return;
                }
                try
                {
                    xml = XDocument.Load(UsersRemoteSoftwares);
                }
                catch (FileNotFoundException ex)
                {
                    if (!File.Exists(UsersRemoteSoftwares))
                    {
                        //File.Create(UsersRemoteSoftwares);
                        var xEle = new XElement("RemoteSoftwares",
                                                new XElement("Software",
                                                             new XElement("ProgramPath", ""),
                                                             new XElement("Options", ""),
                                                             new XElement("Name", "Default Name")
                                                             ));
                        xEle.Save(UsersRemoteSoftwares);
                        GetUsersRemoteSoftwares();
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message + "  " + UsersRemoteSoftwares, "GetUsersRemoteSoftwares Load Software from xml: ");
                }

                if (xml != null)
                {
                    var Software = xml.Root.Elements("Software").ToList();

                    foreach (var item in Software)
                    {
                        RemoteSoftware _xmlRemoteSoftware = new RemoteSoftware();

                        _xmlRemoteSoftware.Name        = item.Element("Name") == null ? "Name Error" : item.Element("Name").Value.ToString();
                        _xmlRemoteSoftware.Options     = item.Element("Options") == null ? "Options Error" : item.Element("Options").Value.ToString();
                        _xmlRemoteSoftware.ProgramPath = item.Element("ProgramPath") == null ? "ProgramPath Error" : item.Element("ProgramPath").Value.ToString();
                        listbuttons.Add(_xmlRemoteSoftware);
                    }
                }
            }
                              );


            #endregion
            await Task.WhenAll(t);

            if (listbuttons.Count == 0)
            {
                listbuttons.Add(new RemoteSoftware()
                {
                    Name = "Default Name"
                });
            }
            return(listbuttons);
        }