예제 #1
0
 public DlgSearchResults(FrmMain mainForm, Solution[] results) : base(mainForm)
 {
     this.EntryList = new LinkedList<SearchResultEntry>();
     this.components = null;
     this.InitializeComponent();
     this.mService = new GPG.Multiplayer.Quazal.SolutionsLib.Service();
     this.mService.Url = ConfigSettings.GetString("SolutionsLibService", "http://gpgnet.gaspowered.com/quazal/Service.asmx?WSDL");
     this.mResultSet = results;
 }
예제 #2
0
 private static void DoStraightLookup(object sender, GetSolutionDetailsCompletedEventArgs e)
 {
     Service.GetSolutionDetailsCompleted -= new GetSolutionDetailsCompletedEventHandler(Solution.DoStraightLookup);
     Solution solution = new Solution((int) e.UserState, e.title);
     solution.Author = e.author;
     solution.Description = e.Result;
     solution.Keywords = e.keywords;
     AsyncOps.Add(solution.ID, solution);
 }
예제 #3
0
 public DlgSolution(FrmMain mainForm, Solution solution) : base(mainForm)
 {
     this.mSolutionHistory = new LinkedList<Solution>();
     this.AsyncInProgress = false;
     this.LookupsInProgress = new List<int>();
     this.components = null;
     this.InitializeComponent();
     this.mService = new GPG.Multiplayer.Quazal.SolutionsLib.Service();
     this.mService.Url = ConfigSettings.GetString("SolutionsLibService", "http://gpgnet.gaspowered.com/quazal/Service.asmx?WSDL");
     this.mCurrentSolution = solution;
     this.SolutionHistory.AddFirst(solution);
     this.LookupSolution();
 }
예제 #4
0
 public void AddSolution(Solution solution)
 {
     for (LinkedListNode<Solution> node = this.SolutionHistory.First; node != null; node = node.Next)
     {
         if (node.Value.ID == solution.ID)
         {
             this.mCurrentSolution = node.Value;
             this.LookupSolution();
             return;
         }
     }
     this.mCurrentSolution = solution;
     this.SolutionHistory.AddLast(solution);
     this.LookupSolution();
 }
예제 #5
0
 private void skinButtonNext_Click(object sender, EventArgs e)
 {
     LinkedListNode<Solution> node = this.SolutionHistory.Find(this.CurrentSolution);
     if (node.Next != null)
     {
         this.mCurrentSolution = node.Next.Value;
         this.LookupSolution();
     }
 }
예제 #6
0
 public void LookupSolution(int id)
 {
     if (!this.LookupsInProgress.Contains(id))
     {
         this.LookupsInProgress.Add(id);
         for (LinkedListNode<Solution> node = this.SolutionHistory.First; node != null; node = node.Next)
         {
             if (node.Value.ID == id)
             {
                 this.mCurrentSolution = node.Value;
                 this.LookupSolution();
                 return;
             }
         }
         this.AsyncInProgress = true;
         this.Service.GetSolutionDetailsCompleted += new GetSolutionDetailsCompletedEventHandler(this.DoStraightLookup);
         this.Service.GetSolutionDetailsAsync(id, id);
     }
 }
예제 #7
0
 private void DoStraightLookup(object sender, GetSolutionDetailsCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         ErrorLog.WriteLine(e.Error);
     }
     else if (!e.Cancelled)
     {
         int userState = (int) e.UserState;
         this.LookupsInProgress.Remove(userState);
         this.Service.GetSolutionDetailsCompleted -= new GetSolutionDetailsCompletedEventHandler(this.DoStraightLookup);
         Solution solution = new Solution(userState, e.title);
         solution.Author = e.author;
         solution.Description = e.Result;
         solution.Keywords = e.keywords;
         this.SolutionHistory.AddLast(solution);
         this.mCurrentSolution = solution;
         this.LookupSolution();
     }
 }
예제 #8
0
 internal void ShowDlgSolution(Solution solution)
 {
     FormClosedEventHandler handler = null;
     if (((this.DlgSolution == null) || this.DlgSolution.Disposing) || this.DlgSolution.IsDisposed)
     {
         this.DlgSolution = new GPG.Multiplayer.Client.SolutionsLib.DlgSolution(this, solution);
         if (handler == null)
         {
             handler = delegate (object s, FormClosedEventArgs e) {
                 this.ActiveDialogs.Remove(this.DlgKeywordSearch);
                 this.DlgKeywordSearch = null;
             };
         }
         this.DlgSolution.FormClosed += handler;
         this.DlgSolution.Show();
     }
     else
     {
         this.DlgSolution.AddSolution(solution);
         this.DlgSolution.BringToFront();
     }
 }
예제 #9
0
 internal void ShowDlgSearchResults(Solution[] results)
 {
     FormClosedEventHandler handler = null;
     if (((this.DlgSearchResults == null) || this.DlgSearchResults.Disposing) || this.DlgSearchResults.IsDisposed)
     {
         this.DlgSearchResults = new GPG.Multiplayer.Client.SolutionsLib.DlgSearchResults(this, results);
         if (handler == null)
         {
             handler = delegate (object s, FormClosedEventArgs e) {
                 this.ActiveDialogs.Remove(this.DlgSearchResults);
                 this.DlgSearchResults = null;
             };
         }
         this.DlgSearchResults.FormClosed += handler;
         this.DlgSearchResults.Show();
     }
     else
     {
         this.DlgSearchResults.ResultSet = results;
         this.DlgSearchResults.RefreshResults();
         this.DlgSearchResults.BringToFront();
     }
 }
예제 #10
0
 private void Service_SLKeywordSearchCompleted(object sender, SLKeywordSearchCompletedEventArgs e)
 {
     VGen0 method = null;
     if (!e.Cancelled)
     {
         if ((base.InvokeRequired && !base.Disposing) && !base.IsDisposed)
         {
             if (method == null)
             {
                 method = delegate {
                     this.Service_SLKeywordSearchCompleted(sender, e);
                 };
             }
             base.BeginInvoke(method);
         }
         else if (!base.Disposing && !base.IsDisposed)
         {
             try
             {
                 if (((e.Error != null) || (e.Result == null)) || (e.Result.Length < 1))
                 {
                     base.SetStatus("<LOC>No results found.", new object[0]);
                     this.Service.SLKeywordSearchCompleted -= new SLKeywordSearchCompletedEventHandler(this.Service_SLKeywordSearchCompleted);
                 }
                 else
                 {
                     Solution[] results = new Solution[e.Result.Length];
                     string[] strArray = this.gpgTextBoxKeyword.Text.Split(" ".ToCharArray());
                     for (int i = 0; i < results.Length; i++)
                     {
                         results[i] = new Solution(e.Result[i].SolutionID, e.Result[i].Title);
                         results[i].SearchWords = strArray;
                     }
                     base.MainForm.ShowDlgSearchResults(results);
                     this.Service.SLKeywordSearchCompleted -= new SLKeywordSearchCompletedEventHandler(this.Service_SLKeywordSearchCompleted);
                     base.ClearStatus();
                 }
             }
             catch (Exception exception)
             {
                 ErrorLog.WriteLine(exception);
             }
             finally
             {
                 this.skinButtonSearch.Enabled = true;
                 this.gpgTextBoxKeyword.Enabled = true;
                 this.Searching = false;
             }
         }
     }
 }