Ignore:
Timestamp:
Jan 16, 2011, 5:41:21 AM (14 years ago)
Author:
Sam Habiel
Message:

CGView: dateTimePicker1 behavior changes:

  • No longer update schedule based on value change, as this is too too too chatty.
  • Update schedule based on:

-- Picking a date from the drop down
-- Leaving dateTimePicker1
-- Pressing the enter key

Location:
Scheduling/trunk/cs/bsdx0200GUISourceCode
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs

    r1062 r1066  
    66using System.Diagnostics;
    77using System.Data;
    8 using System.Net;
    9 using System.Net.Sockets;
    108using System.Threading;
    11 using System.IO;
    129using IndianHealthService.BMXNet;
    13 using System.Reflection;
    1410
    1511
     
    652648            this.tvSchedules.Location = new System.Drawing.Point(0, 0);
    653649            this.tvSchedules.Name = "tvSchedules";
    654             this.tvSchedules.Size = new System.Drawing.Size(128, 479);
     650            this.tvSchedules.Size = new System.Drawing.Size(128, 437);
    655651            this.tvSchedules.Sorted = true;
    656652            this.tvSchedules.TabIndex = 1;
     
    700696            this.panelRight.Location = new System.Drawing.Point(941, 0);
    701697            this.panelRight.Name = "panelRight";
    702             this.panelRight.Size = new System.Drawing.Size(128, 479);
     698            this.panelRight.Size = new System.Drawing.Size(128, 437);
    703699            this.panelRight.TabIndex = 3;
    704700            this.panelRight.Visible = false;
     
    778774            this.dateTimePicker1.Size = new System.Drawing.Size(128, 20);
    779775            this.dateTimePicker1.TabIndex = 1;
    780             this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
     776            this.dateTimePicker1.CloseUp += new System.EventHandler(this.dateTimePicker1_CloseUp);
     777            this.dateTimePicker1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.dateTimePicker1_KeyPress);
     778            this.dateTimePicker1.Leave += new System.EventHandler(this.dateTimePicker1_Leave);
    781779            //
    782780            // lblResource
     
    796794            this.panelCenter.Location = new System.Drawing.Point(136, 24);
    797795            this.panelCenter.Name = "panelCenter";
    798             this.panelCenter.Size = new System.Drawing.Size(802, 431);
     796            this.panelCenter.Size = new System.Drawing.Size(802, 389);
    799797            this.panelCenter.TabIndex = 7;
    800798            //
     
    818816            this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
    819817            this.calendarGrid1.SelectedAppointment = 0;
    820             this.calendarGrid1.Size = new System.Drawing.Size(802, 431);
     818            this.calendarGrid1.Size = new System.Drawing.Size(802, 389);
    821819            this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
    822820            this.calendarGrid1.TabIndex = 0;
     
    910908            this.panelBottom.Controls.Add(this.statusBar1);
    911909            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
    912             this.panelBottom.Location = new System.Drawing.Point(136, 455);
     910            this.panelBottom.Location = new System.Drawing.Point(136, 413);
    913911            this.panelBottom.Name = "panelBottom";
    914912            this.panelBottom.Size = new System.Drawing.Size(802, 24);
     
    928926            this.splitter1.Location = new System.Drawing.Point(128, 24);
    929927            this.splitter1.Name = "splitter1";
    930             this.splitter1.Size = new System.Drawing.Size(8, 455);
     928            this.splitter1.Size = new System.Drawing.Size(8, 413);
    931929            this.splitter1.TabIndex = 9;
    932930            this.splitter1.TabStop = false;
     
    937935            this.splitter2.Location = new System.Drawing.Point(938, 24);
    938936            this.splitter2.Name = "splitter2";
    939             this.splitter2.Size = new System.Drawing.Size(3, 455);
     937            this.splitter2.Size = new System.Drawing.Size(3, 413);
    940938            this.splitter2.TabIndex = 10;
    941939            this.splitter2.TabStop = false;
     
    949947            //
    950948            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    951             this.ClientSize = new System.Drawing.Size(1069, 479);
     949            this.ClientSize = new System.Drawing.Size(1069, 437);
    952950            this.Controls.Add(this.panelCenter);
    953951            this.Controls.Add(this.panelBottom);
     
    14961494                }
    14971495
     1496
    14981497                private void OpenSelectedSchedule(ArrayList sSelectedTreeResourceArray, DateTime dDate)
    14991498                {
    15001499                        //If resource already open, then navigate to its window
     1500            //XXX: Why is this doc definition here? Should be under else scope
     1501            //XXX: Use Bananna peeling instead of if/else
    15011502                        CGDocument doc;
    15021503                        CGView v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray);
     
    15231524                                for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
    15241525                                {
     1526                    // Investigate this. This draws the grid when there is nothing to draw!!!
    15251527                                        doc.AddResource((string) sSelectedTreeResourceArray[j]);
    15261528                                }
     1529
    15271530                                doc.DocName = this.m_sDocName;
    1528                                 try
     1531                               
     1532                try
    15291533                                {
    15301534                                        doc.OnOpenDocument();
    15311535                                }
    1532                                 catch (Exception ex)
     1536                               
     1537                catch (Exception ex)
    15331538                                {
    15341539                                        MessageBox.Show("Unable to open " + m_sDocName + " schedule.  " +  ex.Message, "Clinical Scheduling");
     
    22462251                public void UpdateArrays()
    22472252                {
     2253            // Make sure that we are called synchronously
    22482254                        Debug.Assert(this.InvokeRequired == false,"CGView.UpdateArrays InvokeRequired");
    22492255            // This is where you set how the grid will look
     
    23772383                        //Register the view
    23782384                        CGDocumentManager.Current.RegisterDocumentView(this.Document, this);
    2379             this.mnu5Day.Click += new System.EventHandler(this.dateTimePicker1_ValueChanged); // MJL 1/17/2007
    2380             this.mnu7Day.Click += new System.EventHandler(this.dateTimePicker1_ValueChanged);
    23812385
    23822386                        //Load the Group-Resource treeview
     
    24092413            this.Document.m_nColumnCount = 5; // MJL 1/17/2007
    24102414            //this.Document.UpdateAllViews();
     2415            //TODO: Is there a way to just reuse the existing arrays? How far in the future do they go?
     2416            RequestRefreshGrid();
    24112417                }
    24122418
     
    24152421                        this.calendarGrid1.Columns = 7;
    24162422            this.Document.m_nColumnCount = 7; // MJL 1/17/2007
     2423            //TODO: Is there a way to just reuse the existing arrays? How far in the future do they go?
     2424            RequestRefreshGrid();
    24172425        }
    24182426
     
    25802588                }
    25812589
    2582                 private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
    2583                 {
    2584                         DateTime dDate = dateTimePicker1.Value;
    2585                         dDate = dDate.Date;
    2586                         this.Document.SelectedDate = dDate;
    2587                         if (this.Document.Resources.Count == 1)
    2588                         {
    2589                                 if (this.calendarGrid1.Columns > 1)
    2590                                 {
    2591                                         this.StartDate = this.Document.StartDate;
    2592                                 }
    2593                                 else
    2594                                 {
    2595                                         this.StartDate = this.Document.SelectedDate;
    2596                                 }
    2597                         }
    2598                         else
    2599                         {
    2600                                         this.StartDate = this.Document.SelectedDate;
    2601                         }
    2602                         this.Document.UpdateAllViews();
    2603                         this.calendarGrid1.Invalidate();
    2604                 }
    26052590
    26062591                private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e)
     
    30783063        }
    30793064
     3065       
     3066
     3067        private void dateTimePicker1_Leave(object sender, EventArgs e)
     3068        {
     3069            if (this.Document.SelectedDate != dateTimePicker1.Value.Date)
     3070                RequestRefreshGrid();
     3071        }
     3072
     3073        private void dateTimePicker1_CloseUp(object sender, EventArgs e)
     3074        {
     3075            if (this.Document.SelectedDate != dateTimePicker1.Value.Date)
     3076                RequestRefreshGrid();
     3077        }
     3078
     3079        private void dateTimePicker1_KeyPress(object sender, KeyPressEventArgs e)
     3080        {
     3081            //if enter key is pressed:
     3082            //  Tell windows that we are handling this
     3083            //  Request a Refresh Grid if the date is different
     3084            //  Set-Focus to Calendar Grid
     3085            if (e.KeyChar == (char)Keys.Enter)
     3086            {
     3087                e.Handled = true;
     3088
     3089                if (this.Document.SelectedDate != dateTimePicker1.Value.Date)
     3090                    RequestRefreshGrid();
     3091               
     3092                this.CGrid.Focus();
     3093            }
     3094
     3095            //if escape key is pressed:
     3096            //  Tell windows that we are handling this
     3097            //  Set-Focus to Calendar Grid
     3098            if (e.KeyChar == (char)Keys.Escape)
     3099            {
     3100                e.Handled = true;
     3101                this.CGrid.Focus();
     3102            }
     3103        }
     3104
    30803105
    30813106        #endregion events
    30823107
    3083 
    3084 
    3085 
    3086 
     3108        void RequestRefreshGrid()
     3109        {
     3110            DateTime dDate = dateTimePicker1.Value;
     3111            dDate = dDate.Date;
     3112            // This below is responsible for redrawing the grid when you change the date.
     3113            this.Document.SelectedDate = dDate;
     3114           
     3115            if (this.Document.Resources.Count == 1)
     3116            {
     3117                if (this.calendarGrid1.Columns > 1)
     3118                {
     3119                    this.StartDate = this.Document.StartDate;
     3120                }
     3121                else
     3122                {
     3123                    this.StartDate = this.Document.SelectedDate;
     3124                }
     3125            }
     3126            else
     3127            {
     3128                this.StartDate = this.Document.SelectedDate;
     3129            }
     3130            //Is this needed?
     3131            this.Document.UpdateAllViews();
     3132            //Is this needed?
     3133            this.calendarGrid1.Invalidate();
     3134        }
    30873135
    30883136    }//End class
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.resx

    r804 r1066  
    113113  </resheader>
    114114  <resheader name="reader">
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    116116  </resheader>
    117117  <resheader name="writer">
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     120  <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121121    <value>17, 17</value>
    122122  </metadata>
    123   <metadata name="contextMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     123  <metadata name="contextMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124124    <value>126, 17</value>
    125125  </metadata>
    126   <metadata name="ctxApptClipMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     126  <metadata name="ctxApptClipMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    127127    <value>248, 17</value>
    128128  </metadata>
    129   <metadata name="ctxCalendarGrid.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     129  <metadata name="ctxCalendarGrid.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    130130    <value>382, 17</value>
    131131  </metadata>
     
    136136</value>
    137137  </data>
    138   <metadata name="printRoutingSlip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     138  <metadata name="printRoutingSlip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    139139    <value>512, 17</value>
    140140  </metadata>
    141   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     141  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    142142    <value>75</value>
    143143  </metadata>
    144   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     144  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    145145  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    146146    <value>
Note: See TracChangeset for help on using the changeset viewer.